From a2efc82ccd37f9c7ac7434f27353da993fd66cfc Mon Sep 17 00:00:00 2001 From: Uy Ha Date: Tue, 6 Apr 2021 23:38:23 +0200 Subject: [PATCH] Add some cmake grammars --- grammar.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/grammar.js b/grammar.js index 4db095e..bf04d47 100644 --- a/grammar.js +++ b/grammar.js @@ -2,6 +2,24 @@ module.exports = grammar({ name: 'CMake', rules: { - source_file: $ => 'hello' + source_file: $ => repeat($.command_invocation), + + line_ending: $ => $.newline, + space: $ => /[ \t]+/, + newline: $ => /\n/, + identifier: $ => /[A-Za-z_][A-Za-z0-9_]*/, + argument: $ => /[^ ()#\"\\]+/, + + command_invocation: $ => seq( + repeat($.space), + $.identifier, + repeat($.space), + $.parameter_list, + ), + parameter_list: $ => seq( + '(', + repeat($.argument), + ')' + ) } })