Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[C] Wrong scoping of number if sign and number are on different lines.

Open ngc92 opened this issue 3 years ago • 2 comments

What happened?

The following test case fails with the digit 1 not being scoped as part of the number.

int x = -
//^ storage.type.c
//    ^ keyword.operator.assignment.c
//      ^ keyword.operator.arithmetic.c
   1.53;
// ^^^^ meta.number.float.decimal.c constant.numeric.value.c
//  ^ punctuation.separator.decimal.c
//     ^ punctuation.terminator.c

Interestingly, the scoping works if there are no leading spaces.

ngc92 avatar Nov 24 '22 21:11 ngc92

Having looked at this some more, it seems to me the culprit is

  global:
    - include: early-expressions
    - match: '^\s*(?=\w+)'
      push: global-modifier
    - include: late-expressions

This won't match anything from early-expressions if it is following some leading spaces.

ngc92 avatar Nov 24 '22 21:11 ngc92

C family needs definitly a rewrite.

deathaxe avatar Nov 25 '22 16:11 deathaxe