module.exports = grammar({ name: 'dust', rules: { source_file: $ => repeat(choice($.comment, $.expression)), comment: $ => /(#)(.+?)([\n\r])/, expression: $ => choice( $.identifier, $.integer, $.string, $.list, $.macro, seq($.identifier, $.operator, $.identifier) ), identifier: $ => /[a-zA-Z|_|.]+(_[a-zA-Z]+)*/, operator: $ => choice( '=', '-', '+', ';', '/', '|', '&' ), integer: $ => /\d/, string: $ => /"(.*?)\"/, function: $ => /'(.*?)\'/, list: $ => seq( '(', repeat1(seq($.expression, optional(','))), ')' ), macro: $ => choice( "assert", "assert_equal" ) } });