Skip to content

Commit

Permalink
CM KCL: numbers must have digits after dot (#4963)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Mundell <[email protected]>
  • Loading branch information
jtran and mattmundell authored Jan 7, 2025
1 parent d38bd34 commit debd061
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/codemirror-lang-kcl/src/kcl.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ commaSep1NoTrailingComma<term> { term ("," term)* }
@tokens {
String[isolate] { "'" ("\\" _ | !['\\])* "'" | '"' ("\\" _ | !["\\])* '"' }

Number { "." @digit+ | @digit+ ("." @digit*)? }
Number { "." @digit+ | @digit+ ("." @digit+)? }
@precedence { Number, "." }

AddOp { "+" | "-" }
Expand Down
43 changes: 43 additions & 0 deletions packages/codemirror-lang-kcl/test/range.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# spaced

a = [0 .. 1]

==>
Program(VariableDeclaration(VariableDefinition,
Equals,
ArrayExpression(IntegerRange(Number,
Number))))

# compact

a = [0..1]

==>
Program(VariableDeclaration(VariableDefinition,
Equals,
ArrayExpression(IntegerRange(Number,
Number))))

# expr spaced

a = [start .. start + 10]

==>
Program(VariableDeclaration(VariableDefinition,
Equals,
ArrayExpression(IntegerRange(VariableName,
BinaryExpression(VariableName,
AddOp,
Number)))))

# expr compact

a = [start..start + 10]

==>
Program(VariableDeclaration(VariableDefinition,
Equals,
ArrayExpression(IntegerRange(VariableName,
BinaryExpression(VariableName,
AddOp,
Number)))))

0 comments on commit debd061

Please sign in to comment.