24 lines
393 B
JavaScript
24 lines
393 B
JavaScript
|
module.exports = grammar({
|
||
|
name: 'Dust',
|
||
|
|
||
|
rules: {
|
||
|
source_file: $ => repeat(choice($.comment, $.expression)),
|
||
|
|
||
|
comment: $ => /(#)(.+?)([\n\r])/,
|
||
|
|
||
|
expression: $ => choice(
|
||
|
$.identifier
|
||
|
// TODO: other kinds of definitions
|
||
|
),
|
||
|
|
||
|
identifier: $ => /[a-zA-Z]+(_[a-zA-Z]+)*/,
|
||
|
|
||
|
operator: $ => choice(
|
||
|
'=',
|
||
|
"+",
|
||
|
),
|
||
|
|
||
|
integer: $ => /\d/,
|
||
|
}
|
||
|
});
|