Start work; smol parser
This commit is contained in:
parent
376c39f5ee
commit
f1554ef2e3
|
@ -1,10 +1,20 @@
|
|||
@top File { (Identifier | Number | String)+ }
|
||||
@top Script { terminator* line+ }
|
||||
|
||||
@skip { space }
|
||||
@skip { space | comment }
|
||||
|
||||
line { expression terminator+ }
|
||||
|
||||
expression { Boolean | Nil | String | Number }
|
||||
|
||||
@tokens {
|
||||
space { @whitespace+ }
|
||||
Identifier { $[A-Za-z_]+ }
|
||||
Number { $[0-9]+ }
|
||||
String { '"' !["]* '"' }
|
||||
space { $[ \t\r]+ }
|
||||
comment { "&" ![\n]* }
|
||||
Boolean { "true" | "false" }
|
||||
Nil { "nil" }
|
||||
String { '"' (!["\\] | "\\" _)* '"' }
|
||||
int { $[1-9]$[0-9]* }
|
||||
float { ("0" | int ) $[0.9]+}
|
||||
Number { int | float }
|
||||
separator { $[,\n] }
|
||||
terminator { $[;\n] }
|
||||
}
|
||||
|
|
16
parser.js
16
parser.js
|
@ -2,15 +2,15 @@
|
|||
import {LRParser} from "@lezer/lr"
|
||||
export const parser = LRParser.deserialize({
|
||||
version: 14,
|
||||
states: "hOVQPOOOOQO'#Ca'#CaQVQPOOOOQO-E6_-E6_",
|
||||
stateData: "b~OWOS~OQPORPOSPO~O",
|
||||
goto: "]UPPPPPVQQORRQ",
|
||||
nodeNames: "⚠ File Identifier Number String",
|
||||
maxTerm: 8,
|
||||
states: "!WOYQPOOOOQO'#Cb'#CbOYQPOOOOQO'#Ci'#CiQkQPOOOfQPO'#CcOOQO-E6`-E6`OOQO-E6a-E6aOyQPO,58}",
|
||||
stateData: "!_~OYOSZOS~OQRORROSROTRO[PO~OQRORROSROTRO~O[POQVaRVaSVaTVaWVa~O",
|
||||
goto: "u^PPPPPP_iPPPPPpQQOSUQWRWTSSOQRVSVTOQS",
|
||||
nodeNames: "⚠ Script Boolean Nil String Number",
|
||||
maxTerm: 13,
|
||||
skippedNodes: [0],
|
||||
repeatNodeCount: 1,
|
||||
tokenData: "#z~R_X^!Qpq!Qrs!u!Q![#d!c!}#l#R#S#l#T#o#l#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!VYW~X^!Qpq!Q#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!xTOr!urs#Xs;'S!u;'S;=`#^<%lO!u~#^OS~~#aP;=`<%l!u~#iPR~!Q![#d~#qRQ~!c!}#l#R#S#l#T#o#l",
|
||||
repeatNodeCount: 2,
|
||||
tokenData: "&j~R[XYwYZ!V]^wpqwrs![vw#x!Q!R$a!R![${!]!^!V#Y#Z%^#b#c%{#h#i&^~|RY~XYw]^wpqw~![O[~~!_VOr![rs!ts#O![#O#P!y#P;'S![;'S;=`#r<%lO![~!yOS~~!|RO;'S![;'S;=`#V;=`O![~#YWOr![rs!ts#O![#O#P!y#P;'S![;'S;=`#r;=`<%l![<%lO![~#uP;=`<%l![~#}SZ~OY#xZ;'S#x;'S;=`$Z<%lO#x~$^P;=`<%l#x~$dR!O!P$m!Q!R$m!Z![$m~$rRT~!O!P$m!Q!R$m!Z![$m~%QST~!O!P$m!Q!R${!R!Z${!Z![${~%aP#T#U%d~%gP#`#a%j~%mP#g#h%p~%sP#X#Y%v~%{OQ~~&OP#]#^&R~&UP#`#a&X~&^OR~~&aP#f#g&d~&gP#i#j%p",
|
||||
tokenizers: [0],
|
||||
topRules: {"File":[0,1]},
|
||||
topRules: {"Script":[0,1]},
|
||||
tokenPrec: 0
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
export const
|
||||
File = 1,
|
||||
Identifier = 2,
|
||||
Number = 3,
|
||||
String = 4
|
||||
Script = 1,
|
||||
Boolean = 2,
|
||||
Nil = 3,
|
||||
String = 4,
|
||||
Number = 5
|
||||
|
|
Loading…
Reference in New Issue
Block a user