Restore CodeMirror syntax highlighting
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
@top Source { Statement* }
|
||||
|
||||
Statement {
|
||||
FieldDefinition semicolon? |
|
||||
Expression semicolon?
|
||||
FieldDefinition Semicolon? |
|
||||
Expression Semicolon?
|
||||
}
|
||||
|
||||
Expression { DefaultExpression }
|
||||
|
||||
DefaultExpression {
|
||||
PatchExpression |
|
||||
PatchExpression !default default DefaultExpression
|
||||
PatchExpression !default Default DefaultExpression
|
||||
}
|
||||
|
||||
PatchExpression {
|
||||
ComposeExpression |
|
||||
PatchExpression !patch slashSlash ComposeExpression
|
||||
PatchExpression !patch SlashSlash ComposeExpression
|
||||
}
|
||||
|
||||
ComposeExpression {
|
||||
LogicalOrExpression |
|
||||
ComposeExpression !compose amp LogicalOrExpression
|
||||
ComposeExpression !compose Amp LogicalOrExpression
|
||||
}
|
||||
|
||||
LogicalOrExpression {
|
||||
LogicalAndExpression |
|
||||
LogicalOrExpression !or pipePipe LogicalAndExpression
|
||||
LogicalOrExpression !or PipePipe LogicalAndExpression
|
||||
}
|
||||
|
||||
LogicalAndExpression {
|
||||
ComparisonExpression |
|
||||
LogicalAndExpression !and ampAmp ComparisonExpression
|
||||
LogicalAndExpression !and AmpAmp ComparisonExpression
|
||||
}
|
||||
|
||||
ComparisonExpression {
|
||||
@@ -39,36 +39,36 @@ ComparisonExpression {
|
||||
|
||||
ConcatExpression {
|
||||
AdditiveExpression |
|
||||
ConcatExpression !concat plusPlus AdditiveExpression
|
||||
ConcatExpression !concat PlusPlus AdditiveExpression
|
||||
}
|
||||
|
||||
AdditiveExpression {
|
||||
MultiplicativeExpression |
|
||||
AdditiveExpression !add (plus | minus) MultiplicativeExpression
|
||||
AdditiveExpression !add (Plus | Minus) MultiplicativeExpression
|
||||
}
|
||||
|
||||
MultiplicativeExpression {
|
||||
UnaryExpression |
|
||||
MultiplicativeExpression !multiply (star | slash) UnaryExpression
|
||||
MultiplicativeExpression !multiply (Star | Slash) UnaryExpression
|
||||
}
|
||||
|
||||
UnaryExpression {
|
||||
PostfixExpression |
|
||||
(bang | minus) !unary UnaryExpression
|
||||
(Bang | Minus) !unary UnaryExpression
|
||||
}
|
||||
|
||||
PostfixExpression {
|
||||
PrimaryExpression |
|
||||
PostfixExpression !call CallSuffix |
|
||||
PostfixExpression !path dot identifier
|
||||
PostfixExpression !path Dot Identifier
|
||||
}
|
||||
|
||||
CallSuffix { lParen ArgumentList? rParen }
|
||||
ArgumentList { Expression (comma Expression)* comma? }
|
||||
CallSuffix { LParen ArgumentList? RParen }
|
||||
ArgumentList { Expression (Comma Expression)* Comma? }
|
||||
|
||||
PrimaryExpression {
|
||||
Literal |
|
||||
identifier |
|
||||
Identifier |
|
||||
ComparisonConstraint |
|
||||
Object |
|
||||
Array |
|
||||
@@ -76,31 +76,31 @@ PrimaryExpression {
|
||||
FunctionExpression |
|
||||
MatchExpression |
|
||||
ImportExpression |
|
||||
lParen Expression rParen
|
||||
LParen Expression RParen
|
||||
}
|
||||
|
||||
Literal { string | integer | float | true | false | regex }
|
||||
CompareOperator { equalEqual | bangEqual | lt | lte | gt | gte }
|
||||
ComparisonConstraint { (lt | lte | gt | gte) Expression }
|
||||
Literal { String | Integer | Float | True | False | Regex }
|
||||
CompareOperator { EqualEqual | BangEqual | Lt | Lte | Gt | Gte }
|
||||
ComparisonConstraint { (Lt | Lte | Gt | Gte) Expression }
|
||||
|
||||
Object { lBrace (FieldDefinition (semicolon FieldDefinition)* semicolon?)? rBrace }
|
||||
FieldDefinition { FieldPath equal Expression }
|
||||
FieldPath { identifier !fieldPath (dot identifier)* }
|
||||
Object { LBrace (FieldDefinition (Semicolon FieldDefinition)* Semicolon?)? RBrace }
|
||||
FieldDefinition { FieldPath Equal Expression }
|
||||
FieldPath { Identifier !fieldPath (Dot Identifier)* }
|
||||
|
||||
Array { lBracket (Expression (comma Expression)* comma?)? rBracket }
|
||||
Array { LBracket (Expression (Comma Expression)* Comma?)? RBracket }
|
||||
|
||||
LetExpression { let FieldDefinitionList in Expression }
|
||||
FieldDefinitionList { (FieldDefinition semicolon)* }
|
||||
LetExpression { Let FieldDefinitionList In Expression }
|
||||
FieldDefinitionList { (FieldDefinition Semicolon)* }
|
||||
|
||||
FunctionExpression { lParen ParameterList? rParen arrow Expression }
|
||||
ParameterList { Parameter (comma Parameter)* comma? }
|
||||
Parameter { identifier colon Expression }
|
||||
FunctionExpression { LParen ParameterList? RParen Arrow Expression }
|
||||
ParameterList { Parameter (Comma Parameter)* Comma? }
|
||||
Parameter { Identifier Colon Expression }
|
||||
|
||||
MatchExpression { match Expression lBrace (MatchArm (semicolon MatchArm)* semicolon?)? rBrace }
|
||||
MatchArm { Pattern colon Expression }
|
||||
Pattern { underscore | Expression }
|
||||
MatchExpression { Match Expression LBrace (MatchArm (Semicolon MatchArm)* Semicolon?)? RBrace }
|
||||
MatchArm { Pattern Colon Expression }
|
||||
Pattern { Underscore | Expression }
|
||||
|
||||
ImportExpression { import string }
|
||||
ImportExpression { Import String }
|
||||
|
||||
@precedence {
|
||||
fieldPath @left,
|
||||
@@ -119,54 +119,54 @@ ImportExpression { import string }
|
||||
}
|
||||
|
||||
@tokens {
|
||||
let { "let" }
|
||||
in { "in" }
|
||||
match { "match" }
|
||||
import { "import" }
|
||||
default { "default" }
|
||||
true { "true" }
|
||||
false { "false" }
|
||||
Let { "let" }
|
||||
In { "in" }
|
||||
Match { "match" }
|
||||
Import { "import" }
|
||||
Default { "default" }
|
||||
True { "true" }
|
||||
False { "false" }
|
||||
|
||||
identifier { $[A-Za-z_] $[A-Za-z0-9_]* }
|
||||
integer { $[0-9]+ }
|
||||
float { $[0-9]+ "." $[0-9]+ }
|
||||
string { '"' (!["\\\n] | "\\" _)* '"' }
|
||||
regex { "/" (![/\\\n] | "\\" _)+ "/" }
|
||||
comment { "#" ![\n]* }
|
||||
Identifier { $[A-Za-z_] $[A-Za-z0-9_]* }
|
||||
Integer { $[0-9]+ }
|
||||
Float { $[0-9]+ "." $[0-9]+ }
|
||||
String { '"' (!["\\\n] | "\\" _)* '"' }
|
||||
Regex { "/" (![/\\\n] | "\\" _)+ "/" }
|
||||
Comment { "#" ![\n]* }
|
||||
|
||||
lBrace { "{" }
|
||||
rBrace { "}" }
|
||||
lBracket { "[" }
|
||||
rBracket { "]" }
|
||||
lParen { "(" }
|
||||
rParen { ")" }
|
||||
semicolon { ";" }
|
||||
comma { "," }
|
||||
dot { "." }
|
||||
colon { ":" }
|
||||
equal { "=" }
|
||||
equalEqual { "==" }
|
||||
bang { "!" }
|
||||
bangEqual { "!=" }
|
||||
arrow { "=>" }
|
||||
amp { "&" }
|
||||
ampAmp { "&&" }
|
||||
pipePipe { "||" }
|
||||
plus { "+" }
|
||||
plusPlus { "++" }
|
||||
minus { "-" }
|
||||
star { "*" }
|
||||
slash { "/" }
|
||||
slashSlash { "//" }
|
||||
gt { ">" }
|
||||
gte { ">=" }
|
||||
lt { "<" }
|
||||
lte { "<=" }
|
||||
underscore { "_" }
|
||||
LBrace { "{" }
|
||||
RBrace { "}" }
|
||||
LBracket { "[" }
|
||||
RBracket { "]" }
|
||||
LParen { "(" }
|
||||
RParen { ")" }
|
||||
Semicolon { ";" }
|
||||
Comma { "," }
|
||||
Dot { "." }
|
||||
Colon { ":" }
|
||||
Equal { "=" }
|
||||
EqualEqual { "==" }
|
||||
Bang { "!" }
|
||||
BangEqual { "!=" }
|
||||
Arrow { "=>" }
|
||||
Amp { "&" }
|
||||
AmpAmp { "&&" }
|
||||
PipePipe { "||" }
|
||||
Plus { "+" }
|
||||
PlusPlus { "++" }
|
||||
Minus { "-" }
|
||||
Star { "*" }
|
||||
Slash { "/" }
|
||||
SlashSlash { "//" }
|
||||
Gt { ">" }
|
||||
Gte { ">=" }
|
||||
Lt { "<" }
|
||||
Lte { "<=" }
|
||||
Underscore { "_" }
|
||||
|
||||
whitespace { @whitespace+ }
|
||||
|
||||
@precedence { let, in, match, import, default, true, false, float, integer, underscore, identifier }
|
||||
@precedence { Let, In, Match, Import, Default, True, False, Float, Integer, Underscore, Identifier }
|
||||
}
|
||||
|
||||
@skip { whitespace | comment }
|
||||
@skip { whitespace | Comment }
|
||||
|
||||
Reference in New Issue
Block a user