Skip to content

Conversation

@hkimura-intersys
Copy link
Collaborator

@hkimura-intersys hkimura-intersys commented Jan 20, 2026

Overview

The main changes in this PR include:

  • make sure all command keywords have the field name 'command_name', to allow for easy consistent syntax highlighting.
  • fix the scanner to correctly parse relative dot commands (ex: set x = ..name()). (See below)

Scanner Fix

Before, relative dot methods and relative dot procedures were incorrectly only working in set commands if there was no whitespace between the = and the expression, like this:
image

If there was any whitespace at all, the dots were consumed by the scanner, leading to errors or more subtle incorrect results:

In this example, the rhs should be a relative dot property, but since the dots are consumed, the grammar only sees the three and returns that it is a numeric literal:
image

In this example, we get an error because since the dots were consumed by the scanner, the grammar doesn't match anything:
image

I fixed this by adjusting the scanner to NOT consume any dots if the next node is an expression. This works because if the next node is an expression, we know whatever we are parsing cannot be a dotted statement. This change fixes our issues, and now the relative dot methods and relative dot parameters are being parsed as expected:

image

Consistent Highlighting

Before, some commands didn't have the command_name field, leading to inconsistent highlighting. (see picture below):
image

In this example, set is highlighted a specific color, and write is not.

With this fix, they are highlighted the same color:
image

@hkimura-intersys hkimura-intersys self-assigned this Jan 20, 2026
…t inline.

Before, these nodes were grouped under system_defined_function and
marked as inline, but for Language server purposes, it is helpful
to have access to these nodes.
Having token.immediate() as the first thing for a node can lead to
undefined behavior, in this case it allowed method_name in a class
method call to be nothing.
…if the next node is an expression.

Before, relative dot methods and relative dot procedures were incorrectly only working in set
 commands if there was no whitespace between the = and the expression.

That is because the scanner was incorrectly consuming any dots as potential dotted statements.
I fixed this by making sure the dots aren't consumed if the next node is an expression (as
the only possible dotted statement is a statement, not an expression).
@hkimura-intersys hkimura-intersys changed the title feature: consistent highlighting for commands fix: adjust scanner for correct parsing of dots, and adjust grammar for consistent highlighting of commands Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant