diff --git a/grammar.js b/grammar.js index 997674c..78659be 100644 --- a/grammar.js +++ b/grammar.js @@ -19,7 +19,7 @@ module.exports = grammar({ $.module, ), - line_comment: (_) => seq("//", /[^\n]*/), + line_comment: (_) => seq("//", /.*/), block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'), diff --git a/queries/highlights.scm b/queries/highlights.scm index 9506ebd..124c334 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -42,11 +42,11 @@ (identifier) @variable (module - type: (identifier) @function.call) + type: (identifier) @module) (module (property - field: (identifier) @variable.parameter)) + field: (identifier) @variable.member)) ; }}} ; Built-ins {{{ diff --git a/src/grammar.json b/src/grammar.json index 06f61d9..1dc5a08 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -30,7 +30,7 @@ }, { "type": "PATTERN", - "value": "[^\\n]*" + "value": ".*" } ] }, diff --git a/test/corpus/comments.txt b/test/corpus/comments.txt index 6c91a89..5304a7e 100644 --- a/test/corpus/comments.txt +++ b/test/corpus/comments.txt @@ -85,23 +85,6 @@ Block comment with asterisks -------------------------------------------------------------------------------- -(source_file - (block_comment)) - -================================================================================ -Block comment (multiline) -================================================================================ - -/* - This - is - a - long - comment -*/ - --------------------------------------------------------------------------------- - (source_file (block_comment)) diff --git a/test/highlight/builtins.bp b/test/highlight/builtins.bp index 73b32e3..508a8ed 100644 --- a/test/highlight/builtins.bp +++ b/test/highlight/builtins.bp @@ -2,7 +2,13 @@ foo = select(soong_config_variable("my_namespace", "my_var"), { // ^ function.builtin "foo": unset, // ^ variable.builtin - default: select(variant("VARIANT"), {}), + default: select(variant("VARIANT") {}), // <- variable.builtin // ^ function.builtin }) + +/* Assigning to builtins is conveniently not allowed at runtime */ +unset = 12 +// <- variable.builtin +default = 27 +// <- variable.builtin diff --git a/test/highlight/modules.bp b/test/highlight/modules.bp index e115e6a..248acdf 100644 --- a/test/highlight/modules.bp +++ b/test/highlight/modules.bp @@ -1,21 +1,21 @@ foo {} -// <- function.call +// <- module foo () -// <- function.call +// <- module foo { -// <- function.call +// <- module field: 12, - // <- variable.parameter + // <- variable.member another_field: 27, - // <- variable.parameter + // <- variable.member } foo ( -// <- function.call +// <- module field = 42, - // <- variable.parameter + // <- variable.member done = false, - // <- variable.parameter + // <- variable.member ) diff --git a/test/highlight/properties.bp b/test/highlight/properties.bp index 8ad2c55..6bc97ef 100644 --- a/test/highlight/properties.bp +++ b/test/highlight/properties.bp @@ -1,6 +1,6 @@ foo { field: { - // <- variable.parameter + // <- variable.member key: 42, // <- property }, diff --git a/test/highlight/select.bp b/test/highlight/select.bp index b857c1e..831608d 100644 --- a/test/highlight/select.bp +++ b/test/highlight/select.bp @@ -11,5 +11,5 @@ select = 42 // Or module property foo { select: 42, - // <- variable.parameter + // <- variable.member }