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