mirror of
https://github.com/hi-language/transpiler.git
synced 2026-01-14 00:28:05 +00:00
Fix: Use CommonJS for Nearley grammar preprocessor
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
@{%
|
@{%
|
||||||
import moo from 'moo';
|
const moo = require('moo');
|
||||||
|
|
||||||
export const lexer = moo.compile({
|
const lexer = moo.compile({
|
||||||
ws: /[ \t]+/,
|
ws: /[ \t]+/,
|
||||||
nl: { match: /\n/, lineBreaks: true },
|
nl: { match: /\n/, lineBreaks: true },
|
||||||
comment: /\/\/.*?$/,
|
comment: /\/\/.*?$/,
|
||||||
@@ -106,7 +106,7 @@ Identifier -> %identifier {% d => ({ type: 'Identifier', name: d[0].value }) %}
|
|||||||
Literal -> %number {% d => ({ type: 'NumericLiteral', value: Number(d[0].value) }) %}
|
Literal -> %number {% d => ({ type: 'NumericLiteral', value: Number(d[0].value) }) %}
|
||||||
| %string {% d => ({ type: 'StringLiteral', value: d[0].value }) %}
|
| %string {% d => ({ type: 'StringLiteral', value: d[0].value }) %}
|
||||||
|
|
||||||
Block -> %lbrace _ (KeyValuePairs):? _ %rbrace {%
|
Block -> %lbrace _ (KeyValuePairs):? _ %rparen {%
|
||||||
(d) => ({ type: 'Block', properties: d[2] || [] })
|
(d) => ({ type: 'Block', properties: d[2] || [] })
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user