mirror of
https://github.com/hi-language/transpiler.git
synced 2026-01-14 08:38:37 +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]+/,
|
||||
nl: { match: /\n/, lineBreaks: true },
|
||||
comment: /\/\/.*?$/,
|
||||
@@ -106,7 +106,7 @@ Identifier -> %identifier {% d => ({ type: 'Identifier', name: d[0].value }) %}
|
||||
Literal -> %number {% d => ({ type: 'NumericLiteral', value: Number(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] || [] })
|
||||
%}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user