parse.peg.go 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586
  1. package toml
  2. import (
  3. "fmt"
  4. "math"
  5. "sort"
  6. "strconv"
  7. )
  8. const endSymbol rune = 1114112
  9. /* The rule types inferred from the grammar are below. */
  10. type pegRule uint8
  11. const (
  12. ruleUnknown pegRule = iota
  13. ruleTOML
  14. ruleExpression
  15. rulenewline
  16. rulews
  17. rulewsnl
  18. rulecomment
  19. rulekeyval
  20. rulekey
  21. rulebareKey
  22. rulequotedKey
  23. ruleval
  24. ruletable
  25. rulestdTable
  26. rulearrayTable
  27. ruleinlineTable
  28. ruleinlineTableKeyValues
  29. ruletableKey
  30. ruletableKeyComp
  31. ruletableKeySep
  32. ruleinlineTableValSep
  33. ruleinteger
  34. ruleint
  35. rulefloat
  36. rulefrac
  37. ruleexp
  38. rulestring
  39. rulebasicString
  40. rulebasicChar
  41. ruleescaped
  42. rulebasicUnescaped
  43. ruleescape
  44. rulemlBasicString
  45. rulemlBasicBody
  46. ruleliteralString
  47. ruleliteralChar
  48. rulemlLiteralString
  49. rulemlLiteralBody
  50. rulemlLiteralChar
  51. rulehexdigit
  52. rulehexQuad
  53. ruleboolean
  54. ruledateFullYear
  55. ruledateMonth
  56. ruledateMDay
  57. ruletimeHour
  58. ruletimeMinute
  59. ruletimeSecond
  60. ruletimeSecfrac
  61. ruletimeNumoffset
  62. ruletimeOffset
  63. rulepartialTime
  64. rulefullDate
  65. rulefullTime
  66. ruledatetime
  67. ruledigit
  68. ruledigitDual
  69. ruledigitQuad
  70. rulearray
  71. rulearrayValues
  72. rulearraySep
  73. ruleAction0
  74. rulePegText
  75. ruleAction1
  76. ruleAction2
  77. ruleAction3
  78. ruleAction4
  79. ruleAction5
  80. ruleAction6
  81. ruleAction7
  82. ruleAction8
  83. ruleAction9
  84. ruleAction10
  85. ruleAction11
  86. ruleAction12
  87. ruleAction13
  88. ruleAction14
  89. ruleAction15
  90. ruleAction16
  91. ruleAction17
  92. ruleAction18
  93. ruleAction19
  94. ruleAction20
  95. ruleAction21
  96. ruleAction22
  97. ruleAction23
  98. ruleAction24
  99. ruleAction25
  100. )
  101. var rul3s = [...]string{
  102. "Unknown",
  103. "TOML",
  104. "Expression",
  105. "newline",
  106. "ws",
  107. "wsnl",
  108. "comment",
  109. "keyval",
  110. "key",
  111. "bareKey",
  112. "quotedKey",
  113. "val",
  114. "table",
  115. "stdTable",
  116. "arrayTable",
  117. "inlineTable",
  118. "inlineTableKeyValues",
  119. "tableKey",
  120. "tableKeyComp",
  121. "tableKeySep",
  122. "inlineTableValSep",
  123. "integer",
  124. "int",
  125. "float",
  126. "frac",
  127. "exp",
  128. "string",
  129. "basicString",
  130. "basicChar",
  131. "escaped",
  132. "basicUnescaped",
  133. "escape",
  134. "mlBasicString",
  135. "mlBasicBody",
  136. "literalString",
  137. "literalChar",
  138. "mlLiteralString",
  139. "mlLiteralBody",
  140. "mlLiteralChar",
  141. "hexdigit",
  142. "hexQuad",
  143. "boolean",
  144. "dateFullYear",
  145. "dateMonth",
  146. "dateMDay",
  147. "timeHour",
  148. "timeMinute",
  149. "timeSecond",
  150. "timeSecfrac",
  151. "timeNumoffset",
  152. "timeOffset",
  153. "partialTime",
  154. "fullDate",
  155. "fullTime",
  156. "datetime",
  157. "digit",
  158. "digitDual",
  159. "digitQuad",
  160. "array",
  161. "arrayValues",
  162. "arraySep",
  163. "Action0",
  164. "PegText",
  165. "Action1",
  166. "Action2",
  167. "Action3",
  168. "Action4",
  169. "Action5",
  170. "Action6",
  171. "Action7",
  172. "Action8",
  173. "Action9",
  174. "Action10",
  175. "Action11",
  176. "Action12",
  177. "Action13",
  178. "Action14",
  179. "Action15",
  180. "Action16",
  181. "Action17",
  182. "Action18",
  183. "Action19",
  184. "Action20",
  185. "Action21",
  186. "Action22",
  187. "Action23",
  188. "Action24",
  189. "Action25",
  190. }
  191. type token32 struct {
  192. pegRule
  193. begin, end uint32
  194. }
  195. func (t *token32) String() string {
  196. return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v", rul3s[t.pegRule], t.begin, t.end)
  197. }
  198. type node32 struct {
  199. token32
  200. up, next *node32
  201. }
  202. func (node *node32) print(pretty bool, buffer string) {
  203. var print func(node *node32, depth int)
  204. print = func(node *node32, depth int) {
  205. for node != nil {
  206. for c := 0; c < depth; c++ {
  207. fmt.Printf(" ")
  208. }
  209. rule := rul3s[node.pegRule]
  210. quote := strconv.Quote(string(([]rune(buffer)[node.begin:node.end])))
  211. if !pretty {
  212. fmt.Printf("%v %v\n", rule, quote)
  213. } else {
  214. fmt.Printf("\x1B[34m%v\x1B[m %v\n", rule, quote)
  215. }
  216. if node.up != nil {
  217. print(node.up, depth+1)
  218. }
  219. node = node.next
  220. }
  221. }
  222. print(node, 0)
  223. }
  224. func (node *node32) Print(buffer string) {
  225. node.print(false, buffer)
  226. }
  227. func (node *node32) PrettyPrint(buffer string) {
  228. node.print(true, buffer)
  229. }
  230. type tokens32 struct {
  231. tree []token32
  232. }
  233. func (t *tokens32) Trim(length uint32) {
  234. t.tree = t.tree[:length]
  235. }
  236. func (t *tokens32) Print() {
  237. for _, token := range t.tree {
  238. fmt.Println(token.String())
  239. }
  240. }
  241. func (t *tokens32) AST() *node32 {
  242. type element struct {
  243. node *node32
  244. down *element
  245. }
  246. tokens := t.Tokens()
  247. var stack *element
  248. for _, token := range tokens {
  249. if token.begin == token.end {
  250. continue
  251. }
  252. node := &node32{token32: token}
  253. for stack != nil && stack.node.begin >= token.begin && stack.node.end <= token.end {
  254. stack.node.next = node.up
  255. node.up = stack.node
  256. stack = stack.down
  257. }
  258. stack = &element{node: node, down: stack}
  259. }
  260. if stack != nil {
  261. return stack.node
  262. }
  263. return nil
  264. }
  265. func (t *tokens32) PrintSyntaxTree(buffer string) {
  266. t.AST().Print(buffer)
  267. }
  268. func (t *tokens32) PrettyPrintSyntaxTree(buffer string) {
  269. t.AST().PrettyPrint(buffer)
  270. }
  271. func (t *tokens32) Add(rule pegRule, begin, end, index uint32) {
  272. if tree := t.tree; int(index) >= len(tree) {
  273. expanded := make([]token32, 2*len(tree))
  274. copy(expanded, tree)
  275. t.tree = expanded
  276. }
  277. t.tree[index] = token32{
  278. pegRule: rule,
  279. begin: begin,
  280. end: end,
  281. }
  282. }
  283. func (t *tokens32) Tokens() []token32 {
  284. return t.tree
  285. }
  286. type tomlParser struct {
  287. toml
  288. Buffer string
  289. buffer []rune
  290. rules [88]func() bool
  291. parse func(rule ...int) error
  292. reset func()
  293. Pretty bool
  294. tokens32
  295. }
  296. func (p *tomlParser) Parse(rule ...int) error {
  297. return p.parse(rule...)
  298. }
  299. func (p *tomlParser) Reset() {
  300. p.reset()
  301. }
  302. type textPosition struct {
  303. line, symbol int
  304. }
  305. type textPositionMap map[int]textPosition
  306. func translatePositions(buffer []rune, positions []int) textPositionMap {
  307. length, translations, j, line, symbol := len(positions), make(textPositionMap, len(positions)), 0, 1, 0
  308. sort.Ints(positions)
  309. search:
  310. for i, c := range buffer {
  311. if c == '\n' {
  312. line, symbol = line+1, 0
  313. } else {
  314. symbol++
  315. }
  316. if i == positions[j] {
  317. translations[positions[j]] = textPosition{line, symbol}
  318. for j++; j < length; j++ {
  319. if i != positions[j] {
  320. continue search
  321. }
  322. }
  323. break search
  324. }
  325. }
  326. return translations
  327. }
  328. type parseError struct {
  329. p *tomlParser
  330. max token32
  331. }
  332. func (e *parseError) Error() string {
  333. tokens, error := []token32{e.max}, "\n"
  334. positions, p := make([]int, 2*len(tokens)), 0
  335. for _, token := range tokens {
  336. positions[p], p = int(token.begin), p+1
  337. positions[p], p = int(token.end), p+1
  338. }
  339. translations := translatePositions(e.p.buffer, positions)
  340. format := "parse error near %v (line %v symbol %v - line %v symbol %v):\n%v\n"
  341. if e.p.Pretty {
  342. format = "parse error near \x1B[34m%v\x1B[m (line %v symbol %v - line %v symbol %v):\n%v\n"
  343. }
  344. for _, token := range tokens {
  345. begin, end := int(token.begin), int(token.end)
  346. error += fmt.Sprintf(format,
  347. rul3s[token.pegRule],
  348. translations[begin].line, translations[begin].symbol,
  349. translations[end].line, translations[end].symbol,
  350. strconv.Quote(string(e.p.buffer[begin:end])))
  351. }
  352. return error
  353. }
  354. func (p *tomlParser) PrintSyntaxTree() {
  355. if p.Pretty {
  356. p.tokens32.PrettyPrintSyntaxTree(p.Buffer)
  357. } else {
  358. p.tokens32.PrintSyntaxTree(p.Buffer)
  359. }
  360. }
  361. func (p *tomlParser) Execute() {
  362. buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
  363. for _, token := range p.Tokens() {
  364. switch token.pegRule {
  365. case rulePegText:
  366. begin, end = int(token.begin), int(token.end)
  367. text = string(_buffer[begin:end])
  368. case ruleAction0:
  369. _ = buffer
  370. case ruleAction1:
  371. p.SetTableString(begin, end)
  372. case ruleAction2:
  373. p.AddLineCount(end - begin)
  374. case ruleAction3:
  375. p.AddLineCount(end - begin)
  376. case ruleAction4:
  377. p.AddKeyValue()
  378. case ruleAction5:
  379. p.SetKey(p.buffer, begin, end)
  380. case ruleAction6:
  381. p.SetKey(p.buffer, begin, end)
  382. case ruleAction7:
  383. p.SetTime(begin, end)
  384. case ruleAction8:
  385. p.SetFloat64(begin, end)
  386. case ruleAction9:
  387. p.SetInt64(begin, end)
  388. case ruleAction10:
  389. p.SetString(begin, end)
  390. case ruleAction11:
  391. p.SetBool(begin, end)
  392. case ruleAction12:
  393. p.SetArray(begin, end)
  394. case ruleAction13:
  395. p.SetTable(p.buffer, begin, end)
  396. case ruleAction14:
  397. p.SetArrayTable(p.buffer, begin, end)
  398. case ruleAction15:
  399. p.StartInlineTable()
  400. case ruleAction16:
  401. p.EndInlineTable()
  402. case ruleAction17:
  403. p.AddTableKey()
  404. case ruleAction18:
  405. p.SetBasicString(p.buffer, begin, end)
  406. case ruleAction19:
  407. p.SetMultilineString()
  408. case ruleAction20:
  409. p.AddMultilineBasicBody(p.buffer, begin, end)
  410. case ruleAction21:
  411. p.SetLiteralString(p.buffer, begin, end)
  412. case ruleAction22:
  413. p.SetMultilineLiteralString(p.buffer, begin, end)
  414. case ruleAction23:
  415. p.StartArray()
  416. case ruleAction24:
  417. p.AddArrayVal()
  418. case ruleAction25:
  419. p.AddArrayVal()
  420. }
  421. }
  422. _, _, _, _, _ = buffer, _buffer, text, begin, end
  423. }
  424. func (p *tomlParser) Init() {
  425. var (
  426. max token32
  427. position, tokenIndex uint32
  428. buffer []rune
  429. )
  430. p.reset = func() {
  431. max = token32{}
  432. position, tokenIndex = 0, 0
  433. p.buffer = []rune(p.Buffer)
  434. if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol {
  435. p.buffer = append(p.buffer, endSymbol)
  436. }
  437. buffer = p.buffer
  438. }
  439. p.reset()
  440. _rules := p.rules
  441. tree := tokens32{tree: make([]token32, math.MaxInt16)}
  442. p.parse = func(rule ...int) error {
  443. r := 1
  444. if len(rule) > 0 {
  445. r = rule[0]
  446. }
  447. matches := p.rules[r]()
  448. p.tokens32 = tree
  449. if matches {
  450. p.Trim(tokenIndex)
  451. return nil
  452. }
  453. return &parseError{p, max}
  454. }
  455. add := func(rule pegRule, begin uint32) {
  456. tree.Add(rule, begin, position, tokenIndex)
  457. tokenIndex++
  458. if begin != position && position > max.end {
  459. max = token32{rule, begin, position}
  460. }
  461. }
  462. matchDot := func() bool {
  463. if buffer[position] != endSymbol {
  464. position++
  465. return true
  466. }
  467. return false
  468. }
  469. /*matchChar := func(c byte) bool {
  470. if buffer[position] == c {
  471. position++
  472. return true
  473. }
  474. return false
  475. }*/
  476. /*matchRange := func(lower byte, upper byte) bool {
  477. if c := buffer[position]; c >= lower && c <= upper {
  478. position++
  479. return true
  480. }
  481. return false
  482. }*/
  483. _rules = [...]func() bool{
  484. nil,
  485. /* 0 TOML <- <(Expression (newline Expression)* newline? !. Action0)> */
  486. func() bool {
  487. position0, tokenIndex0 := position, tokenIndex
  488. {
  489. position1 := position
  490. if !_rules[ruleExpression]() {
  491. goto l0
  492. }
  493. l2:
  494. {
  495. position3, tokenIndex3 := position, tokenIndex
  496. if !_rules[rulenewline]() {
  497. goto l3
  498. }
  499. if !_rules[ruleExpression]() {
  500. goto l3
  501. }
  502. goto l2
  503. l3:
  504. position, tokenIndex = position3, tokenIndex3
  505. }
  506. {
  507. position4, tokenIndex4 := position, tokenIndex
  508. if !_rules[rulenewline]() {
  509. goto l4
  510. }
  511. goto l5
  512. l4:
  513. position, tokenIndex = position4, tokenIndex4
  514. }
  515. l5:
  516. {
  517. position6, tokenIndex6 := position, tokenIndex
  518. if !matchDot() {
  519. goto l6
  520. }
  521. goto l0
  522. l6:
  523. position, tokenIndex = position6, tokenIndex6
  524. }
  525. {
  526. add(ruleAction0, position)
  527. }
  528. add(ruleTOML, position1)
  529. }
  530. return true
  531. l0:
  532. position, tokenIndex = position0, tokenIndex0
  533. return false
  534. },
  535. /* 1 Expression <- <((<(ws table ws comment? (wsnl keyval ws comment?)*)> Action1) / (ws keyval ws comment?) / (ws comment?) / ws)> */
  536. func() bool {
  537. position8, tokenIndex8 := position, tokenIndex
  538. {
  539. position9 := position
  540. {
  541. position10, tokenIndex10 := position, tokenIndex
  542. {
  543. position12 := position
  544. if !_rules[rulews]() {
  545. goto l11
  546. }
  547. {
  548. position13 := position
  549. {
  550. position14, tokenIndex14 := position, tokenIndex
  551. {
  552. position16 := position
  553. if buffer[position] != rune('[') {
  554. goto l15
  555. }
  556. position++
  557. if !_rules[rulews]() {
  558. goto l15
  559. }
  560. {
  561. position17 := position
  562. if !_rules[ruletableKey]() {
  563. goto l15
  564. }
  565. add(rulePegText, position17)
  566. }
  567. if !_rules[rulews]() {
  568. goto l15
  569. }
  570. if buffer[position] != rune(']') {
  571. goto l15
  572. }
  573. position++
  574. {
  575. add(ruleAction13, position)
  576. }
  577. add(rulestdTable, position16)
  578. }
  579. goto l14
  580. l15:
  581. position, tokenIndex = position14, tokenIndex14
  582. {
  583. position19 := position
  584. if buffer[position] != rune('[') {
  585. goto l11
  586. }
  587. position++
  588. if buffer[position] != rune('[') {
  589. goto l11
  590. }
  591. position++
  592. if !_rules[rulews]() {
  593. goto l11
  594. }
  595. {
  596. position20 := position
  597. if !_rules[ruletableKey]() {
  598. goto l11
  599. }
  600. add(rulePegText, position20)
  601. }
  602. if !_rules[rulews]() {
  603. goto l11
  604. }
  605. if buffer[position] != rune(']') {
  606. goto l11
  607. }
  608. position++
  609. if buffer[position] != rune(']') {
  610. goto l11
  611. }
  612. position++
  613. {
  614. add(ruleAction14, position)
  615. }
  616. add(rulearrayTable, position19)
  617. }
  618. }
  619. l14:
  620. add(ruletable, position13)
  621. }
  622. if !_rules[rulews]() {
  623. goto l11
  624. }
  625. {
  626. position22, tokenIndex22 := position, tokenIndex
  627. if !_rules[rulecomment]() {
  628. goto l22
  629. }
  630. goto l23
  631. l22:
  632. position, tokenIndex = position22, tokenIndex22
  633. }
  634. l23:
  635. l24:
  636. {
  637. position25, tokenIndex25 := position, tokenIndex
  638. if !_rules[rulewsnl]() {
  639. goto l25
  640. }
  641. if !_rules[rulekeyval]() {
  642. goto l25
  643. }
  644. if !_rules[rulews]() {
  645. goto l25
  646. }
  647. {
  648. position26, tokenIndex26 := position, tokenIndex
  649. if !_rules[rulecomment]() {
  650. goto l26
  651. }
  652. goto l27
  653. l26:
  654. position, tokenIndex = position26, tokenIndex26
  655. }
  656. l27:
  657. goto l24
  658. l25:
  659. position, tokenIndex = position25, tokenIndex25
  660. }
  661. add(rulePegText, position12)
  662. }
  663. {
  664. add(ruleAction1, position)
  665. }
  666. goto l10
  667. l11:
  668. position, tokenIndex = position10, tokenIndex10
  669. if !_rules[rulews]() {
  670. goto l29
  671. }
  672. if !_rules[rulekeyval]() {
  673. goto l29
  674. }
  675. if !_rules[rulews]() {
  676. goto l29
  677. }
  678. {
  679. position30, tokenIndex30 := position, tokenIndex
  680. if !_rules[rulecomment]() {
  681. goto l30
  682. }
  683. goto l31
  684. l30:
  685. position, tokenIndex = position30, tokenIndex30
  686. }
  687. l31:
  688. goto l10
  689. l29:
  690. position, tokenIndex = position10, tokenIndex10
  691. if !_rules[rulews]() {
  692. goto l32
  693. }
  694. {
  695. position33, tokenIndex33 := position, tokenIndex
  696. if !_rules[rulecomment]() {
  697. goto l33
  698. }
  699. goto l34
  700. l33:
  701. position, tokenIndex = position33, tokenIndex33
  702. }
  703. l34:
  704. goto l10
  705. l32:
  706. position, tokenIndex = position10, tokenIndex10
  707. if !_rules[rulews]() {
  708. goto l8
  709. }
  710. }
  711. l10:
  712. add(ruleExpression, position9)
  713. }
  714. return true
  715. l8:
  716. position, tokenIndex = position8, tokenIndex8
  717. return false
  718. },
  719. /* 2 newline <- <(<('\r' / '\n')+> Action2)> */
  720. func() bool {
  721. position35, tokenIndex35 := position, tokenIndex
  722. {
  723. position36 := position
  724. {
  725. position37 := position
  726. {
  727. position40, tokenIndex40 := position, tokenIndex
  728. if buffer[position] != rune('\r') {
  729. goto l41
  730. }
  731. position++
  732. goto l40
  733. l41:
  734. position, tokenIndex = position40, tokenIndex40
  735. if buffer[position] != rune('\n') {
  736. goto l35
  737. }
  738. position++
  739. }
  740. l40:
  741. l38:
  742. {
  743. position39, tokenIndex39 := position, tokenIndex
  744. {
  745. position42, tokenIndex42 := position, tokenIndex
  746. if buffer[position] != rune('\r') {
  747. goto l43
  748. }
  749. position++
  750. goto l42
  751. l43:
  752. position, tokenIndex = position42, tokenIndex42
  753. if buffer[position] != rune('\n') {
  754. goto l39
  755. }
  756. position++
  757. }
  758. l42:
  759. goto l38
  760. l39:
  761. position, tokenIndex = position39, tokenIndex39
  762. }
  763. add(rulePegText, position37)
  764. }
  765. {
  766. add(ruleAction2, position)
  767. }
  768. add(rulenewline, position36)
  769. }
  770. return true
  771. l35:
  772. position, tokenIndex = position35, tokenIndex35
  773. return false
  774. },
  775. /* 3 ws <- <(' ' / '\t')*> */
  776. func() bool {
  777. {
  778. position46 := position
  779. l47:
  780. {
  781. position48, tokenIndex48 := position, tokenIndex
  782. {
  783. position49, tokenIndex49 := position, tokenIndex
  784. if buffer[position] != rune(' ') {
  785. goto l50
  786. }
  787. position++
  788. goto l49
  789. l50:
  790. position, tokenIndex = position49, tokenIndex49
  791. if buffer[position] != rune('\t') {
  792. goto l48
  793. }
  794. position++
  795. }
  796. l49:
  797. goto l47
  798. l48:
  799. position, tokenIndex = position48, tokenIndex48
  800. }
  801. add(rulews, position46)
  802. }
  803. return true
  804. },
  805. /* 4 wsnl <- <((&('\t') '\t') | (&(' ') ' ') | (&('\n' | '\r') (<('\r' / '\n')> Action3)))*> */
  806. func() bool {
  807. {
  808. position52 := position
  809. l53:
  810. {
  811. position54, tokenIndex54 := position, tokenIndex
  812. {
  813. switch buffer[position] {
  814. case '\t':
  815. if buffer[position] != rune('\t') {
  816. goto l54
  817. }
  818. position++
  819. break
  820. case ' ':
  821. if buffer[position] != rune(' ') {
  822. goto l54
  823. }
  824. position++
  825. break
  826. default:
  827. {
  828. position56 := position
  829. {
  830. position57, tokenIndex57 := position, tokenIndex
  831. if buffer[position] != rune('\r') {
  832. goto l58
  833. }
  834. position++
  835. goto l57
  836. l58:
  837. position, tokenIndex = position57, tokenIndex57
  838. if buffer[position] != rune('\n') {
  839. goto l54
  840. }
  841. position++
  842. }
  843. l57:
  844. add(rulePegText, position56)
  845. }
  846. {
  847. add(ruleAction3, position)
  848. }
  849. break
  850. }
  851. }
  852. goto l53
  853. l54:
  854. position, tokenIndex = position54, tokenIndex54
  855. }
  856. add(rulewsnl, position52)
  857. }
  858. return true
  859. },
  860. /* 5 comment <- <('#' <('\t' / [ -\U0010ffff])*>)> */
  861. func() bool {
  862. position60, tokenIndex60 := position, tokenIndex
  863. {
  864. position61 := position
  865. if buffer[position] != rune('#') {
  866. goto l60
  867. }
  868. position++
  869. {
  870. position62 := position
  871. l63:
  872. {
  873. position64, tokenIndex64 := position, tokenIndex
  874. {
  875. position65, tokenIndex65 := position, tokenIndex
  876. if buffer[position] != rune('\t') {
  877. goto l66
  878. }
  879. position++
  880. goto l65
  881. l66:
  882. position, tokenIndex = position65, tokenIndex65
  883. if c := buffer[position]; c < rune(' ') || c > rune('\U0010ffff') {
  884. goto l64
  885. }
  886. position++
  887. }
  888. l65:
  889. goto l63
  890. l64:
  891. position, tokenIndex = position64, tokenIndex64
  892. }
  893. add(rulePegText, position62)
  894. }
  895. add(rulecomment, position61)
  896. }
  897. return true
  898. l60:
  899. position, tokenIndex = position60, tokenIndex60
  900. return false
  901. },
  902. /* 6 keyval <- <(key ws '=' ws val Action4)> */
  903. func() bool {
  904. position67, tokenIndex67 := position, tokenIndex
  905. {
  906. position68 := position
  907. if !_rules[rulekey]() {
  908. goto l67
  909. }
  910. if !_rules[rulews]() {
  911. goto l67
  912. }
  913. if buffer[position] != rune('=') {
  914. goto l67
  915. }
  916. position++
  917. if !_rules[rulews]() {
  918. goto l67
  919. }
  920. if !_rules[ruleval]() {
  921. goto l67
  922. }
  923. {
  924. add(ruleAction4, position)
  925. }
  926. add(rulekeyval, position68)
  927. }
  928. return true
  929. l67:
  930. position, tokenIndex = position67, tokenIndex67
  931. return false
  932. },
  933. /* 7 key <- <(bareKey / quotedKey)> */
  934. func() bool {
  935. position70, tokenIndex70 := position, tokenIndex
  936. {
  937. position71 := position
  938. {
  939. position72, tokenIndex72 := position, tokenIndex
  940. {
  941. position74 := position
  942. {
  943. position75 := position
  944. {
  945. switch buffer[position] {
  946. case '_':
  947. if buffer[position] != rune('_') {
  948. goto l73
  949. }
  950. position++
  951. break
  952. case '-':
  953. if buffer[position] != rune('-') {
  954. goto l73
  955. }
  956. position++
  957. break
  958. case 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z':
  959. if c := buffer[position]; c < rune('a') || c > rune('z') {
  960. goto l73
  961. }
  962. position++
  963. break
  964. case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
  965. if c := buffer[position]; c < rune('0') || c > rune('9') {
  966. goto l73
  967. }
  968. position++
  969. break
  970. default:
  971. if c := buffer[position]; c < rune('A') || c > rune('Z') {
  972. goto l73
  973. }
  974. position++
  975. break
  976. }
  977. }
  978. l76:
  979. {
  980. position77, tokenIndex77 := position, tokenIndex
  981. {
  982. switch buffer[position] {
  983. case '_':
  984. if buffer[position] != rune('_') {
  985. goto l77
  986. }
  987. position++
  988. break
  989. case '-':
  990. if buffer[position] != rune('-') {
  991. goto l77
  992. }
  993. position++
  994. break
  995. case 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z':
  996. if c := buffer[position]; c < rune('a') || c > rune('z') {
  997. goto l77
  998. }
  999. position++
  1000. break
  1001. case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
  1002. if c := buffer[position]; c < rune('0') || c > rune('9') {
  1003. goto l77
  1004. }
  1005. position++
  1006. break
  1007. default:
  1008. if c := buffer[position]; c < rune('A') || c > rune('Z') {
  1009. goto l77
  1010. }
  1011. position++
  1012. break
  1013. }
  1014. }
  1015. goto l76
  1016. l77:
  1017. position, tokenIndex = position77, tokenIndex77
  1018. }
  1019. add(rulePegText, position75)
  1020. }
  1021. {
  1022. add(ruleAction5, position)
  1023. }
  1024. add(rulebareKey, position74)
  1025. }
  1026. goto l72
  1027. l73:
  1028. position, tokenIndex = position72, tokenIndex72
  1029. {
  1030. position81 := position
  1031. {
  1032. position82 := position
  1033. if buffer[position] != rune('"') {
  1034. goto l70
  1035. }
  1036. position++
  1037. l83:
  1038. {
  1039. position84, tokenIndex84 := position, tokenIndex
  1040. if !_rules[rulebasicChar]() {
  1041. goto l84
  1042. }
  1043. goto l83
  1044. l84:
  1045. position, tokenIndex = position84, tokenIndex84
  1046. }
  1047. if buffer[position] != rune('"') {
  1048. goto l70
  1049. }
  1050. position++
  1051. add(rulePegText, position82)
  1052. }
  1053. {
  1054. add(ruleAction6, position)
  1055. }
  1056. add(rulequotedKey, position81)
  1057. }
  1058. }
  1059. l72:
  1060. add(rulekey, position71)
  1061. }
  1062. return true
  1063. l70:
  1064. position, tokenIndex = position70, tokenIndex70
  1065. return false
  1066. },
  1067. /* 8 bareKey <- <(<((&('_') '_') | (&('-') '-') | (&('a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') [a-z]) | (&('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') [0-9]) | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z') [A-Z]))+> Action5)> */
  1068. nil,
  1069. /* 9 quotedKey <- <(<('"' basicChar* '"')> Action6)> */
  1070. nil,
  1071. /* 10 val <- <((<datetime> Action7) / (<float> Action8) / ((&('{') inlineTable) | (&('[') (<array> Action12)) | (&('f' | 't') (<boolean> Action11)) | (&('"' | '\'') (<string> Action10)) | (&('+' | '-' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') (<integer> Action9))))> */
  1072. func() bool {
  1073. position88, tokenIndex88 := position, tokenIndex
  1074. {
  1075. position89 := position
  1076. {
  1077. position90, tokenIndex90 := position, tokenIndex
  1078. {
  1079. position92 := position
  1080. {
  1081. position93 := position
  1082. {
  1083. position94, tokenIndex94 := position, tokenIndex
  1084. {
  1085. position96 := position
  1086. {
  1087. position97 := position
  1088. {
  1089. position98 := position
  1090. if !_rules[ruledigitDual]() {
  1091. goto l95
  1092. }
  1093. if !_rules[ruledigitDual]() {
  1094. goto l95
  1095. }
  1096. add(ruledigitQuad, position98)
  1097. }
  1098. add(ruledateFullYear, position97)
  1099. }
  1100. if buffer[position] != rune('-') {
  1101. goto l95
  1102. }
  1103. position++
  1104. {
  1105. position99 := position
  1106. if !_rules[ruledigitDual]() {
  1107. goto l95
  1108. }
  1109. add(ruledateMonth, position99)
  1110. }
  1111. if buffer[position] != rune('-') {
  1112. goto l95
  1113. }
  1114. position++
  1115. {
  1116. position100 := position
  1117. if !_rules[ruledigitDual]() {
  1118. goto l95
  1119. }
  1120. add(ruledateMDay, position100)
  1121. }
  1122. add(rulefullDate, position96)
  1123. }
  1124. {
  1125. position101, tokenIndex101 := position, tokenIndex
  1126. if buffer[position] != rune('T') {
  1127. goto l101
  1128. }
  1129. position++
  1130. {
  1131. position103 := position
  1132. if !_rules[rulepartialTime]() {
  1133. goto l101
  1134. }
  1135. {
  1136. position104, tokenIndex104 := position, tokenIndex
  1137. {
  1138. position106 := position
  1139. {
  1140. position107, tokenIndex107 := position, tokenIndex
  1141. if buffer[position] != rune('Z') {
  1142. goto l108
  1143. }
  1144. position++
  1145. goto l107
  1146. l108:
  1147. position, tokenIndex = position107, tokenIndex107
  1148. {
  1149. position109 := position
  1150. {
  1151. position110, tokenIndex110 := position, tokenIndex
  1152. if buffer[position] != rune('-') {
  1153. goto l111
  1154. }
  1155. position++
  1156. goto l110
  1157. l111:
  1158. position, tokenIndex = position110, tokenIndex110
  1159. if buffer[position] != rune('+') {
  1160. goto l104
  1161. }
  1162. position++
  1163. }
  1164. l110:
  1165. if !_rules[ruletimeHour]() {
  1166. goto l104
  1167. }
  1168. if buffer[position] != rune(':') {
  1169. goto l104
  1170. }
  1171. position++
  1172. if !_rules[ruletimeMinute]() {
  1173. goto l104
  1174. }
  1175. add(ruletimeNumoffset, position109)
  1176. }
  1177. }
  1178. l107:
  1179. add(ruletimeOffset, position106)
  1180. }
  1181. goto l105
  1182. l104:
  1183. position, tokenIndex = position104, tokenIndex104
  1184. }
  1185. l105:
  1186. add(rulefullTime, position103)
  1187. }
  1188. goto l102
  1189. l101:
  1190. position, tokenIndex = position101, tokenIndex101
  1191. }
  1192. l102:
  1193. goto l94
  1194. l95:
  1195. position, tokenIndex = position94, tokenIndex94
  1196. if !_rules[rulepartialTime]() {
  1197. goto l91
  1198. }
  1199. }
  1200. l94:
  1201. add(ruledatetime, position93)
  1202. }
  1203. add(rulePegText, position92)
  1204. }
  1205. {
  1206. add(ruleAction7, position)
  1207. }
  1208. goto l90
  1209. l91:
  1210. position, tokenIndex = position90, tokenIndex90
  1211. {
  1212. position114 := position
  1213. {
  1214. position115 := position
  1215. if !_rules[ruleinteger]() {
  1216. goto l113
  1217. }
  1218. {
  1219. position116, tokenIndex116 := position, tokenIndex
  1220. if !_rules[rulefrac]() {
  1221. goto l117
  1222. }
  1223. {
  1224. position118, tokenIndex118 := position, tokenIndex
  1225. if !_rules[ruleexp]() {
  1226. goto l118
  1227. }
  1228. goto l119
  1229. l118:
  1230. position, tokenIndex = position118, tokenIndex118
  1231. }
  1232. l119:
  1233. goto l116
  1234. l117:
  1235. position, tokenIndex = position116, tokenIndex116
  1236. {
  1237. position120, tokenIndex120 := position, tokenIndex
  1238. if !_rules[rulefrac]() {
  1239. goto l120
  1240. }
  1241. goto l121
  1242. l120:
  1243. position, tokenIndex = position120, tokenIndex120
  1244. }
  1245. l121:
  1246. if !_rules[ruleexp]() {
  1247. goto l113
  1248. }
  1249. }
  1250. l116:
  1251. add(rulefloat, position115)
  1252. }
  1253. add(rulePegText, position114)
  1254. }
  1255. {
  1256. add(ruleAction8, position)
  1257. }
  1258. goto l90
  1259. l113:
  1260. position, tokenIndex = position90, tokenIndex90
  1261. {
  1262. switch buffer[position] {
  1263. case '{':
  1264. {
  1265. position124 := position
  1266. if buffer[position] != rune('{') {
  1267. goto l88
  1268. }
  1269. position++
  1270. {
  1271. add(ruleAction15, position)
  1272. }
  1273. if !_rules[rulews]() {
  1274. goto l88
  1275. }
  1276. {
  1277. position126 := position
  1278. l127:
  1279. {
  1280. position128, tokenIndex128 := position, tokenIndex
  1281. if !_rules[rulekeyval]() {
  1282. goto l128
  1283. }
  1284. {
  1285. position129, tokenIndex129 := position, tokenIndex
  1286. {
  1287. position131 := position
  1288. if !_rules[rulews]() {
  1289. goto l129
  1290. }
  1291. if buffer[position] != rune(',') {
  1292. goto l129
  1293. }
  1294. position++
  1295. if !_rules[rulews]() {
  1296. goto l129
  1297. }
  1298. add(ruleinlineTableValSep, position131)
  1299. }
  1300. goto l130
  1301. l129:
  1302. position, tokenIndex = position129, tokenIndex129
  1303. }
  1304. l130:
  1305. goto l127
  1306. l128:
  1307. position, tokenIndex = position128, tokenIndex128
  1308. }
  1309. add(ruleinlineTableKeyValues, position126)
  1310. }
  1311. if !_rules[rulews]() {
  1312. goto l88
  1313. }
  1314. if buffer[position] != rune('}') {
  1315. goto l88
  1316. }
  1317. position++
  1318. {
  1319. add(ruleAction16, position)
  1320. }
  1321. add(ruleinlineTable, position124)
  1322. }
  1323. break
  1324. case '[':
  1325. {
  1326. position133 := position
  1327. {
  1328. position134 := position
  1329. if buffer[position] != rune('[') {
  1330. goto l88
  1331. }
  1332. position++
  1333. {
  1334. add(ruleAction23, position)
  1335. }
  1336. if !_rules[rulewsnl]() {
  1337. goto l88
  1338. }
  1339. {
  1340. position136, tokenIndex136 := position, tokenIndex
  1341. {
  1342. position138 := position
  1343. if !_rules[ruleval]() {
  1344. goto l136
  1345. }
  1346. {
  1347. add(ruleAction24, position)
  1348. }
  1349. l140:
  1350. {
  1351. position141, tokenIndex141 := position, tokenIndex
  1352. if !_rules[rulewsnl]() {
  1353. goto l141
  1354. }
  1355. {
  1356. position142, tokenIndex142 := position, tokenIndex
  1357. if !_rules[rulecomment]() {
  1358. goto l142
  1359. }
  1360. goto l143
  1361. l142:
  1362. position, tokenIndex = position142, tokenIndex142
  1363. }
  1364. l143:
  1365. if !_rules[rulewsnl]() {
  1366. goto l141
  1367. }
  1368. if !_rules[rulearraySep]() {
  1369. goto l141
  1370. }
  1371. if !_rules[rulewsnl]() {
  1372. goto l141
  1373. }
  1374. {
  1375. position144, tokenIndex144 := position, tokenIndex
  1376. if !_rules[rulecomment]() {
  1377. goto l144
  1378. }
  1379. goto l145
  1380. l144:
  1381. position, tokenIndex = position144, tokenIndex144
  1382. }
  1383. l145:
  1384. if !_rules[rulewsnl]() {
  1385. goto l141
  1386. }
  1387. if !_rules[ruleval]() {
  1388. goto l141
  1389. }
  1390. {
  1391. add(ruleAction25, position)
  1392. }
  1393. goto l140
  1394. l141:
  1395. position, tokenIndex = position141, tokenIndex141
  1396. }
  1397. if !_rules[rulewsnl]() {
  1398. goto l136
  1399. }
  1400. {
  1401. position147, tokenIndex147 := position, tokenIndex
  1402. if !_rules[rulearraySep]() {
  1403. goto l147
  1404. }
  1405. goto l148
  1406. l147:
  1407. position, tokenIndex = position147, tokenIndex147
  1408. }
  1409. l148:
  1410. if !_rules[rulewsnl]() {
  1411. goto l136
  1412. }
  1413. {
  1414. position149, tokenIndex149 := position, tokenIndex
  1415. if !_rules[rulecomment]() {
  1416. goto l149
  1417. }
  1418. goto l150
  1419. l149:
  1420. position, tokenIndex = position149, tokenIndex149
  1421. }
  1422. l150:
  1423. add(rulearrayValues, position138)
  1424. }
  1425. goto l137
  1426. l136:
  1427. position, tokenIndex = position136, tokenIndex136
  1428. }
  1429. l137:
  1430. if !_rules[rulewsnl]() {
  1431. goto l88
  1432. }
  1433. if buffer[position] != rune(']') {
  1434. goto l88
  1435. }
  1436. position++
  1437. add(rulearray, position134)
  1438. }
  1439. add(rulePegText, position133)
  1440. }
  1441. {
  1442. add(ruleAction12, position)
  1443. }
  1444. break
  1445. case 'f', 't':
  1446. {
  1447. position152 := position
  1448. {
  1449. position153 := position
  1450. {
  1451. position154, tokenIndex154 := position, tokenIndex
  1452. if buffer[position] != rune('t') {
  1453. goto l155
  1454. }
  1455. position++
  1456. if buffer[position] != rune('r') {
  1457. goto l155
  1458. }
  1459. position++
  1460. if buffer[position] != rune('u') {
  1461. goto l155
  1462. }
  1463. position++
  1464. if buffer[position] != rune('e') {
  1465. goto l155
  1466. }
  1467. position++
  1468. goto l154
  1469. l155:
  1470. position, tokenIndex = position154, tokenIndex154
  1471. if buffer[position] != rune('f') {
  1472. goto l88
  1473. }
  1474. position++
  1475. if buffer[position] != rune('a') {
  1476. goto l88
  1477. }
  1478. position++
  1479. if buffer[position] != rune('l') {
  1480. goto l88
  1481. }
  1482. position++
  1483. if buffer[position] != rune('s') {
  1484. goto l88
  1485. }
  1486. position++
  1487. if buffer[position] != rune('e') {
  1488. goto l88
  1489. }
  1490. position++
  1491. }
  1492. l154:
  1493. add(ruleboolean, position153)
  1494. }
  1495. add(rulePegText, position152)
  1496. }
  1497. {
  1498. add(ruleAction11, position)
  1499. }
  1500. break
  1501. case '"', '\'':
  1502. {
  1503. position157 := position
  1504. {
  1505. position158 := position
  1506. {
  1507. position159, tokenIndex159 := position, tokenIndex
  1508. {
  1509. position161 := position
  1510. if buffer[position] != rune('\'') {
  1511. goto l160
  1512. }
  1513. position++
  1514. if buffer[position] != rune('\'') {
  1515. goto l160
  1516. }
  1517. position++
  1518. if buffer[position] != rune('\'') {
  1519. goto l160
  1520. }
  1521. position++
  1522. {
  1523. position162 := position
  1524. {
  1525. position163 := position
  1526. l164:
  1527. {
  1528. position165, tokenIndex165 := position, tokenIndex
  1529. {
  1530. position166, tokenIndex166 := position, tokenIndex
  1531. if buffer[position] != rune('\'') {
  1532. goto l166
  1533. }
  1534. position++
  1535. if buffer[position] != rune('\'') {
  1536. goto l166
  1537. }
  1538. position++
  1539. if buffer[position] != rune('\'') {
  1540. goto l166
  1541. }
  1542. position++
  1543. goto l165
  1544. l166:
  1545. position, tokenIndex = position166, tokenIndex166
  1546. }
  1547. {
  1548. position167, tokenIndex167 := position, tokenIndex
  1549. {
  1550. position169 := position
  1551. {
  1552. position170, tokenIndex170 := position, tokenIndex
  1553. if buffer[position] != rune('\t') {
  1554. goto l171
  1555. }
  1556. position++
  1557. goto l170
  1558. l171:
  1559. position, tokenIndex = position170, tokenIndex170
  1560. if c := buffer[position]; c < rune(' ') || c > rune('\U0010ffff') {
  1561. goto l168
  1562. }
  1563. position++
  1564. }
  1565. l170:
  1566. add(rulemlLiteralChar, position169)
  1567. }
  1568. goto l167
  1569. l168:
  1570. position, tokenIndex = position167, tokenIndex167
  1571. if !_rules[rulenewline]() {
  1572. goto l165
  1573. }
  1574. }
  1575. l167:
  1576. goto l164
  1577. l165:
  1578. position, tokenIndex = position165, tokenIndex165
  1579. }
  1580. add(rulemlLiteralBody, position163)
  1581. }
  1582. add(rulePegText, position162)
  1583. }
  1584. if buffer[position] != rune('\'') {
  1585. goto l160
  1586. }
  1587. position++
  1588. if buffer[position] != rune('\'') {
  1589. goto l160
  1590. }
  1591. position++
  1592. if buffer[position] != rune('\'') {
  1593. goto l160
  1594. }
  1595. position++
  1596. {
  1597. add(ruleAction22, position)
  1598. }
  1599. add(rulemlLiteralString, position161)
  1600. }
  1601. goto l159
  1602. l160:
  1603. position, tokenIndex = position159, tokenIndex159
  1604. {
  1605. position174 := position
  1606. if buffer[position] != rune('\'') {
  1607. goto l173
  1608. }
  1609. position++
  1610. {
  1611. position175 := position
  1612. l176:
  1613. {
  1614. position177, tokenIndex177 := position, tokenIndex
  1615. {
  1616. position178 := position
  1617. {
  1618. switch buffer[position] {
  1619. case '\t':
  1620. if buffer[position] != rune('\t') {
  1621. goto l177
  1622. }
  1623. position++
  1624. break
  1625. case ' ', '!', '"', '#', '$', '%', '&':
  1626. if c := buffer[position]; c < rune(' ') || c > rune('&') {
  1627. goto l177
  1628. }
  1629. position++
  1630. break
  1631. default:
  1632. if c := buffer[position]; c < rune('(') || c > rune('\U0010ffff') {
  1633. goto l177
  1634. }
  1635. position++
  1636. break
  1637. }
  1638. }
  1639. add(ruleliteralChar, position178)
  1640. }
  1641. goto l176
  1642. l177:
  1643. position, tokenIndex = position177, tokenIndex177
  1644. }
  1645. add(rulePegText, position175)
  1646. }
  1647. if buffer[position] != rune('\'') {
  1648. goto l173
  1649. }
  1650. position++
  1651. {
  1652. add(ruleAction21, position)
  1653. }
  1654. add(ruleliteralString, position174)
  1655. }
  1656. goto l159
  1657. l173:
  1658. position, tokenIndex = position159, tokenIndex159
  1659. {
  1660. position182 := position
  1661. if buffer[position] != rune('"') {
  1662. goto l181
  1663. }
  1664. position++
  1665. if buffer[position] != rune('"') {
  1666. goto l181
  1667. }
  1668. position++
  1669. if buffer[position] != rune('"') {
  1670. goto l181
  1671. }
  1672. position++
  1673. {
  1674. position183 := position
  1675. l184:
  1676. {
  1677. position185, tokenIndex185 := position, tokenIndex
  1678. {
  1679. position186, tokenIndex186 := position, tokenIndex
  1680. {
  1681. position188 := position
  1682. {
  1683. position189, tokenIndex189 := position, tokenIndex
  1684. if !_rules[rulebasicChar]() {
  1685. goto l190
  1686. }
  1687. goto l189
  1688. l190:
  1689. position, tokenIndex = position189, tokenIndex189
  1690. if !_rules[rulenewline]() {
  1691. goto l187
  1692. }
  1693. }
  1694. l189:
  1695. add(rulePegText, position188)
  1696. }
  1697. {
  1698. add(ruleAction20, position)
  1699. }
  1700. goto l186
  1701. l187:
  1702. position, tokenIndex = position186, tokenIndex186
  1703. if !_rules[ruleescape]() {
  1704. goto l185
  1705. }
  1706. if !_rules[rulenewline]() {
  1707. goto l185
  1708. }
  1709. if !_rules[rulewsnl]() {
  1710. goto l185
  1711. }
  1712. }
  1713. l186:
  1714. goto l184
  1715. l185:
  1716. position, tokenIndex = position185, tokenIndex185
  1717. }
  1718. add(rulemlBasicBody, position183)
  1719. }
  1720. if buffer[position] != rune('"') {
  1721. goto l181
  1722. }
  1723. position++
  1724. if buffer[position] != rune('"') {
  1725. goto l181
  1726. }
  1727. position++
  1728. if buffer[position] != rune('"') {
  1729. goto l181
  1730. }
  1731. position++
  1732. {
  1733. add(ruleAction19, position)
  1734. }
  1735. add(rulemlBasicString, position182)
  1736. }
  1737. goto l159
  1738. l181:
  1739. position, tokenIndex = position159, tokenIndex159
  1740. {
  1741. position193 := position
  1742. {
  1743. position194 := position
  1744. if buffer[position] != rune('"') {
  1745. goto l88
  1746. }
  1747. position++
  1748. l195:
  1749. {
  1750. position196, tokenIndex196 := position, tokenIndex
  1751. if !_rules[rulebasicChar]() {
  1752. goto l196
  1753. }
  1754. goto l195
  1755. l196:
  1756. position, tokenIndex = position196, tokenIndex196
  1757. }
  1758. if buffer[position] != rune('"') {
  1759. goto l88
  1760. }
  1761. position++
  1762. add(rulePegText, position194)
  1763. }
  1764. {
  1765. add(ruleAction18, position)
  1766. }
  1767. add(rulebasicString, position193)
  1768. }
  1769. }
  1770. l159:
  1771. add(rulestring, position158)
  1772. }
  1773. add(rulePegText, position157)
  1774. }
  1775. {
  1776. add(ruleAction10, position)
  1777. }
  1778. break
  1779. default:
  1780. {
  1781. position199 := position
  1782. if !_rules[ruleinteger]() {
  1783. goto l88
  1784. }
  1785. add(rulePegText, position199)
  1786. }
  1787. {
  1788. add(ruleAction9, position)
  1789. }
  1790. break
  1791. }
  1792. }
  1793. }
  1794. l90:
  1795. add(ruleval, position89)
  1796. }
  1797. return true
  1798. l88:
  1799. position, tokenIndex = position88, tokenIndex88
  1800. return false
  1801. },
  1802. /* 11 table <- <(stdTable / arrayTable)> */
  1803. nil,
  1804. /* 12 stdTable <- <('[' ws <tableKey> ws ']' Action13)> */
  1805. nil,
  1806. /* 13 arrayTable <- <('[' '[' ws <tableKey> ws (']' ']') Action14)> */
  1807. nil,
  1808. /* 14 inlineTable <- <('{' Action15 ws inlineTableKeyValues ws '}' Action16)> */
  1809. nil,
  1810. /* 15 inlineTableKeyValues <- <(keyval inlineTableValSep?)*> */
  1811. nil,
  1812. /* 16 tableKey <- <(tableKeyComp (tableKeySep tableKeyComp)*)> */
  1813. func() bool {
  1814. position206, tokenIndex206 := position, tokenIndex
  1815. {
  1816. position207 := position
  1817. if !_rules[ruletableKeyComp]() {
  1818. goto l206
  1819. }
  1820. l208:
  1821. {
  1822. position209, tokenIndex209 := position, tokenIndex
  1823. {
  1824. position210 := position
  1825. if !_rules[rulews]() {
  1826. goto l209
  1827. }
  1828. if buffer[position] != rune('.') {
  1829. goto l209
  1830. }
  1831. position++
  1832. if !_rules[rulews]() {
  1833. goto l209
  1834. }
  1835. add(ruletableKeySep, position210)
  1836. }
  1837. if !_rules[ruletableKeyComp]() {
  1838. goto l209
  1839. }
  1840. goto l208
  1841. l209:
  1842. position, tokenIndex = position209, tokenIndex209
  1843. }
  1844. add(ruletableKey, position207)
  1845. }
  1846. return true
  1847. l206:
  1848. position, tokenIndex = position206, tokenIndex206
  1849. return false
  1850. },
  1851. /* 17 tableKeyComp <- <(key Action17)> */
  1852. func() bool {
  1853. position211, tokenIndex211 := position, tokenIndex
  1854. {
  1855. position212 := position
  1856. if !_rules[rulekey]() {
  1857. goto l211
  1858. }
  1859. {
  1860. add(ruleAction17, position)
  1861. }
  1862. add(ruletableKeyComp, position212)
  1863. }
  1864. return true
  1865. l211:
  1866. position, tokenIndex = position211, tokenIndex211
  1867. return false
  1868. },
  1869. /* 18 tableKeySep <- <(ws '.' ws)> */
  1870. nil,
  1871. /* 19 inlineTableValSep <- <(ws ',' ws)> */
  1872. nil,
  1873. /* 20 integer <- <(('-' / '+')? int)> */
  1874. func() bool {
  1875. position216, tokenIndex216 := position, tokenIndex
  1876. {
  1877. position217 := position
  1878. {
  1879. position218, tokenIndex218 := position, tokenIndex
  1880. {
  1881. position220, tokenIndex220 := position, tokenIndex
  1882. if buffer[position] != rune('-') {
  1883. goto l221
  1884. }
  1885. position++
  1886. goto l220
  1887. l221:
  1888. position, tokenIndex = position220, tokenIndex220
  1889. if buffer[position] != rune('+') {
  1890. goto l218
  1891. }
  1892. position++
  1893. }
  1894. l220:
  1895. goto l219
  1896. l218:
  1897. position, tokenIndex = position218, tokenIndex218
  1898. }
  1899. l219:
  1900. {
  1901. position222 := position
  1902. {
  1903. position223, tokenIndex223 := position, tokenIndex
  1904. if c := buffer[position]; c < rune('1') || c > rune('9') {
  1905. goto l224
  1906. }
  1907. position++
  1908. {
  1909. position227, tokenIndex227 := position, tokenIndex
  1910. if !_rules[ruledigit]() {
  1911. goto l228
  1912. }
  1913. goto l227
  1914. l228:
  1915. position, tokenIndex = position227, tokenIndex227
  1916. if buffer[position] != rune('_') {
  1917. goto l224
  1918. }
  1919. position++
  1920. if !_rules[ruledigit]() {
  1921. goto l224
  1922. }
  1923. }
  1924. l227:
  1925. l225:
  1926. {
  1927. position226, tokenIndex226 := position, tokenIndex
  1928. {
  1929. position229, tokenIndex229 := position, tokenIndex
  1930. if !_rules[ruledigit]() {
  1931. goto l230
  1932. }
  1933. goto l229
  1934. l230:
  1935. position, tokenIndex = position229, tokenIndex229
  1936. if buffer[position] != rune('_') {
  1937. goto l226
  1938. }
  1939. position++
  1940. if !_rules[ruledigit]() {
  1941. goto l226
  1942. }
  1943. }
  1944. l229:
  1945. goto l225
  1946. l226:
  1947. position, tokenIndex = position226, tokenIndex226
  1948. }
  1949. goto l223
  1950. l224:
  1951. position, tokenIndex = position223, tokenIndex223
  1952. if !_rules[ruledigit]() {
  1953. goto l216
  1954. }
  1955. }
  1956. l223:
  1957. add(ruleint, position222)
  1958. }
  1959. add(ruleinteger, position217)
  1960. }
  1961. return true
  1962. l216:
  1963. position, tokenIndex = position216, tokenIndex216
  1964. return false
  1965. },
  1966. /* 21 int <- <(([1-9] (digit / ('_' digit))+) / digit)> */
  1967. nil,
  1968. /* 22 float <- <(integer ((frac exp?) / (frac? exp)))> */
  1969. nil,
  1970. /* 23 frac <- <('.' digit (digit / ('_' digit))*)> */
  1971. func() bool {
  1972. position233, tokenIndex233 := position, tokenIndex
  1973. {
  1974. position234 := position
  1975. if buffer[position] != rune('.') {
  1976. goto l233
  1977. }
  1978. position++
  1979. if !_rules[ruledigit]() {
  1980. goto l233
  1981. }
  1982. l235:
  1983. {
  1984. position236, tokenIndex236 := position, tokenIndex
  1985. {
  1986. position237, tokenIndex237 := position, tokenIndex
  1987. if !_rules[ruledigit]() {
  1988. goto l238
  1989. }
  1990. goto l237
  1991. l238:
  1992. position, tokenIndex = position237, tokenIndex237
  1993. if buffer[position] != rune('_') {
  1994. goto l236
  1995. }
  1996. position++
  1997. if !_rules[ruledigit]() {
  1998. goto l236
  1999. }
  2000. }
  2001. l237:
  2002. goto l235
  2003. l236:
  2004. position, tokenIndex = position236, tokenIndex236
  2005. }
  2006. add(rulefrac, position234)
  2007. }
  2008. return true
  2009. l233:
  2010. position, tokenIndex = position233, tokenIndex233
  2011. return false
  2012. },
  2013. /* 24 exp <- <(('e' / 'E') ('-' / '+')? digit (digit / ('_' digit))*)> */
  2014. func() bool {
  2015. position239, tokenIndex239 := position, tokenIndex
  2016. {
  2017. position240 := position
  2018. {
  2019. position241, tokenIndex241 := position, tokenIndex
  2020. if buffer[position] != rune('e') {
  2021. goto l242
  2022. }
  2023. position++
  2024. goto l241
  2025. l242:
  2026. position, tokenIndex = position241, tokenIndex241
  2027. if buffer[position] != rune('E') {
  2028. goto l239
  2029. }
  2030. position++
  2031. }
  2032. l241:
  2033. {
  2034. position243, tokenIndex243 := position, tokenIndex
  2035. {
  2036. position245, tokenIndex245 := position, tokenIndex
  2037. if buffer[position] != rune('-') {
  2038. goto l246
  2039. }
  2040. position++
  2041. goto l245
  2042. l246:
  2043. position, tokenIndex = position245, tokenIndex245
  2044. if buffer[position] != rune('+') {
  2045. goto l243
  2046. }
  2047. position++
  2048. }
  2049. l245:
  2050. goto l244
  2051. l243:
  2052. position, tokenIndex = position243, tokenIndex243
  2053. }
  2054. l244:
  2055. if !_rules[ruledigit]() {
  2056. goto l239
  2057. }
  2058. l247:
  2059. {
  2060. position248, tokenIndex248 := position, tokenIndex
  2061. {
  2062. position249, tokenIndex249 := position, tokenIndex
  2063. if !_rules[ruledigit]() {
  2064. goto l250
  2065. }
  2066. goto l249
  2067. l250:
  2068. position, tokenIndex = position249, tokenIndex249
  2069. if buffer[position] != rune('_') {
  2070. goto l248
  2071. }
  2072. position++
  2073. if !_rules[ruledigit]() {
  2074. goto l248
  2075. }
  2076. }
  2077. l249:
  2078. goto l247
  2079. l248:
  2080. position, tokenIndex = position248, tokenIndex248
  2081. }
  2082. add(ruleexp, position240)
  2083. }
  2084. return true
  2085. l239:
  2086. position, tokenIndex = position239, tokenIndex239
  2087. return false
  2088. },
  2089. /* 25 string <- <(mlLiteralString / literalString / mlBasicString / basicString)> */
  2090. nil,
  2091. /* 26 basicString <- <(<('"' basicChar* '"')> Action18)> */
  2092. nil,
  2093. /* 27 basicChar <- <(basicUnescaped / escaped)> */
  2094. func() bool {
  2095. position253, tokenIndex253 := position, tokenIndex
  2096. {
  2097. position254 := position
  2098. {
  2099. position255, tokenIndex255 := position, tokenIndex
  2100. {
  2101. position257 := position
  2102. {
  2103. switch buffer[position] {
  2104. case ' ', '!':
  2105. if c := buffer[position]; c < rune(' ') || c > rune('!') {
  2106. goto l256
  2107. }
  2108. position++
  2109. break
  2110. case '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[':
  2111. if c := buffer[position]; c < rune('#') || c > rune('[') {
  2112. goto l256
  2113. }
  2114. position++
  2115. break
  2116. default:
  2117. if c := buffer[position]; c < rune(']') || c > rune('\U0010ffff') {
  2118. goto l256
  2119. }
  2120. position++
  2121. break
  2122. }
  2123. }
  2124. add(rulebasicUnescaped, position257)
  2125. }
  2126. goto l255
  2127. l256:
  2128. position, tokenIndex = position255, tokenIndex255
  2129. {
  2130. position259 := position
  2131. if !_rules[ruleescape]() {
  2132. goto l253
  2133. }
  2134. {
  2135. switch buffer[position] {
  2136. case 'U':
  2137. if buffer[position] != rune('U') {
  2138. goto l253
  2139. }
  2140. position++
  2141. if !_rules[rulehexQuad]() {
  2142. goto l253
  2143. }
  2144. if !_rules[rulehexQuad]() {
  2145. goto l253
  2146. }
  2147. break
  2148. case 'u':
  2149. if buffer[position] != rune('u') {
  2150. goto l253
  2151. }
  2152. position++
  2153. if !_rules[rulehexQuad]() {
  2154. goto l253
  2155. }
  2156. break
  2157. case '\\':
  2158. if buffer[position] != rune('\\') {
  2159. goto l253
  2160. }
  2161. position++
  2162. break
  2163. case '/':
  2164. if buffer[position] != rune('/') {
  2165. goto l253
  2166. }
  2167. position++
  2168. break
  2169. case '"':
  2170. if buffer[position] != rune('"') {
  2171. goto l253
  2172. }
  2173. position++
  2174. break
  2175. case 'r':
  2176. if buffer[position] != rune('r') {
  2177. goto l253
  2178. }
  2179. position++
  2180. break
  2181. case 'f':
  2182. if buffer[position] != rune('f') {
  2183. goto l253
  2184. }
  2185. position++
  2186. break
  2187. case 'n':
  2188. if buffer[position] != rune('n') {
  2189. goto l253
  2190. }
  2191. position++
  2192. break
  2193. case 't':
  2194. if buffer[position] != rune('t') {
  2195. goto l253
  2196. }
  2197. position++
  2198. break
  2199. default:
  2200. if buffer[position] != rune('b') {
  2201. goto l253
  2202. }
  2203. position++
  2204. break
  2205. }
  2206. }
  2207. add(ruleescaped, position259)
  2208. }
  2209. }
  2210. l255:
  2211. add(rulebasicChar, position254)
  2212. }
  2213. return true
  2214. l253:
  2215. position, tokenIndex = position253, tokenIndex253
  2216. return false
  2217. },
  2218. /* 28 escaped <- <(escape ((&('U') ('U' hexQuad hexQuad)) | (&('u') ('u' hexQuad)) | (&('\\') '\\') | (&('/') '/') | (&('"') '"') | (&('r') 'r') | (&('f') 'f') | (&('n') 'n') | (&('t') 't') | (&('b') 'b')))> */
  2219. nil,
  2220. /* 29 basicUnescaped <- <((&(' ' | '!') [ -!]) | (&('#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[') [#-[]) | (&(']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' | '\u007f' | '\u0080' | '\u0081' | '\u0082' | '\u0083' | '\u0084' | '\u0085' | '\u0086' | '\u0087' | '\u0088' | '\u0089' | '\u008a' | '\u008b' | '\u008c' | '\u008d' | '\u008e' | '\u008f' | '\u0090' | '\u0091' | '\u0092' | '\u0093' | '\u0094' | '\u0095' | '\u0096' | '\u0097' | '\u0098' | '\u0099' | '\u009a' | '\u009b' | '\u009c' | '\u009d' | '\u009e' | '\u009f' | '\u00a0' | '¡' | '¢' | '£' | '¤' | '¥' | '¦' | '§' | '¨' | '©' | 'ª' | '«' | '¬' | '\u00ad' | '®' | '¯' | '°' | '±' | '²' | '³' | '´' | 'µ' | '¶' | '·' | '¸' | '¹' | 'º' | '»' | '¼' | '½' | '¾' | '¿' | 'À' | 'Á' | 'Â' | 'Ã' | 'Ä' | 'Å' | 'Æ' | 'Ç' | 'È' | 'É' | 'Ê' | 'Ë' | 'Ì' | 'Í' | 'Î' | 'Ï' | 'Ð' | 'Ñ' | 'Ò' | 'Ó' | 'Ô' | 'Õ' | 'Ö' | '×' | 'Ø' | 'Ù' | 'Ú' | 'Û' | 'Ü' | 'Ý' | 'Þ' | 'ß' | 'à' | 'á' | 'â' | 'ã' | 'ä' | 'å' | 'æ' | 'ç' | 'è' | 'é' | 'ê' | 'ë' | 'ì' | 'í' | 'î' | 'ï' | 'ð' | 'ñ' | 'ò' | 'ó' | 'ô' | 'õ' | 'ö' | '÷' | 'ø' | 'ù' | 'ú' | 'û' | 'ü' | 'ý' | 'þ' | 'ÿ') []-\U0010ffff]))> */
  2221. nil,
  2222. /* 30 escape <- <'\\'> */
  2223. func() bool {
  2224. position263, tokenIndex263 := position, tokenIndex
  2225. {
  2226. position264 := position
  2227. if buffer[position] != rune('\\') {
  2228. goto l263
  2229. }
  2230. position++
  2231. add(ruleescape, position264)
  2232. }
  2233. return true
  2234. l263:
  2235. position, tokenIndex = position263, tokenIndex263
  2236. return false
  2237. },
  2238. /* 31 mlBasicString <- <('"' '"' '"' mlBasicBody ('"' '"' '"') Action19)> */
  2239. nil,
  2240. /* 32 mlBasicBody <- <((<(basicChar / newline)> Action20) / (escape newline wsnl))*> */
  2241. nil,
  2242. /* 33 literalString <- <('\'' <literalChar*> '\'' Action21)> */
  2243. nil,
  2244. /* 34 literalChar <- <((&('\t') '\t') | (&(' ' | '!' | '"' | '#' | '$' | '%' | '&') [ -&]) | (&('(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' | '\u007f' | '\u0080' | '\u0081' | '\u0082' | '\u0083' | '\u0084' | '\u0085' | '\u0086' | '\u0087' | '\u0088' | '\u0089' | '\u008a' | '\u008b' | '\u008c' | '\u008d' | '\u008e' | '\u008f' | '\u0090' | '\u0091' | '\u0092' | '\u0093' | '\u0094' | '\u0095' | '\u0096' | '\u0097' | '\u0098' | '\u0099' | '\u009a' | '\u009b' | '\u009c' | '\u009d' | '\u009e' | '\u009f' | '\u00a0' | '¡' | '¢' | '£' | '¤' | '¥' | '¦' | '§' | '¨' | '©' | 'ª' | '«' | '¬' | '\u00ad' | '®' | '¯' | '°' | '±' | '²' | '³' | '´' | 'µ' | '¶' | '·' | '¸' | '¹' | 'º' | '»' | '¼' | '½' | '¾' | '¿' | 'À' | 'Á' | 'Â' | 'Ã' | 'Ä' | 'Å' | 'Æ' | 'Ç' | 'È' | 'É' | 'Ê' | 'Ë' | 'Ì' | 'Í' | 'Î' | 'Ï' | 'Ð' | 'Ñ' | 'Ò' | 'Ó' | 'Ô' | 'Õ' | 'Ö' | '×' | 'Ø' | 'Ù' | 'Ú' | 'Û' | 'Ü' | 'Ý' | 'Þ' | 'ß' | 'à' | 'á' | 'â' | 'ã' | 'ä' | 'å' | 'æ' | 'ç' | 'è' | 'é' | 'ê' | 'ë' | 'ì' | 'í' | 'î' | 'ï' | 'ð' | 'ñ' | 'ò' | 'ó' | 'ô' | 'õ' | 'ö' | '÷' | 'ø' | 'ù' | 'ú' | 'û' | 'ü' | 'ý' | 'þ' | 'ÿ') [(-\U0010ffff]))> */
  2245. nil,
  2246. /* 35 mlLiteralString <- <('\'' '\'' '\'' <mlLiteralBody> ('\'' '\'' '\'') Action22)> */
  2247. nil,
  2248. /* 36 mlLiteralBody <- <(!('\'' '\'' '\'') (mlLiteralChar / newline))*> */
  2249. nil,
  2250. /* 37 mlLiteralChar <- <('\t' / [ -\U0010ffff])> */
  2251. nil,
  2252. /* 38 hexdigit <- <((&('a' | 'b' | 'c' | 'd' | 'e' | 'f') [a-f]) | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F') [A-F]) | (&('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') [0-9]))> */
  2253. func() bool {
  2254. position272, tokenIndex272 := position, tokenIndex
  2255. {
  2256. position273 := position
  2257. {
  2258. switch buffer[position] {
  2259. case 'a', 'b', 'c', 'd', 'e', 'f':
  2260. if c := buffer[position]; c < rune('a') || c > rune('f') {
  2261. goto l272
  2262. }
  2263. position++
  2264. break
  2265. case 'A', 'B', 'C', 'D', 'E', 'F':
  2266. if c := buffer[position]; c < rune('A') || c > rune('F') {
  2267. goto l272
  2268. }
  2269. position++
  2270. break
  2271. default:
  2272. if c := buffer[position]; c < rune('0') || c > rune('9') {
  2273. goto l272
  2274. }
  2275. position++
  2276. break
  2277. }
  2278. }
  2279. add(rulehexdigit, position273)
  2280. }
  2281. return true
  2282. l272:
  2283. position, tokenIndex = position272, tokenIndex272
  2284. return false
  2285. },
  2286. /* 39 hexQuad <- <(hexdigit hexdigit hexdigit hexdigit)> */
  2287. func() bool {
  2288. position275, tokenIndex275 := position, tokenIndex
  2289. {
  2290. position276 := position
  2291. if !_rules[rulehexdigit]() {
  2292. goto l275
  2293. }
  2294. if !_rules[rulehexdigit]() {
  2295. goto l275
  2296. }
  2297. if !_rules[rulehexdigit]() {
  2298. goto l275
  2299. }
  2300. if !_rules[rulehexdigit]() {
  2301. goto l275
  2302. }
  2303. add(rulehexQuad, position276)
  2304. }
  2305. return true
  2306. l275:
  2307. position, tokenIndex = position275, tokenIndex275
  2308. return false
  2309. },
  2310. /* 40 boolean <- <(('t' 'r' 'u' 'e') / ('f' 'a' 'l' 's' 'e'))> */
  2311. nil,
  2312. /* 41 dateFullYear <- <digitQuad> */
  2313. nil,
  2314. /* 42 dateMonth <- <digitDual> */
  2315. nil,
  2316. /* 43 dateMDay <- <digitDual> */
  2317. nil,
  2318. /* 44 timeHour <- <digitDual> */
  2319. func() bool {
  2320. position281, tokenIndex281 := position, tokenIndex
  2321. {
  2322. position282 := position
  2323. if !_rules[ruledigitDual]() {
  2324. goto l281
  2325. }
  2326. add(ruletimeHour, position282)
  2327. }
  2328. return true
  2329. l281:
  2330. position, tokenIndex = position281, tokenIndex281
  2331. return false
  2332. },
  2333. /* 45 timeMinute <- <digitDual> */
  2334. func() bool {
  2335. position283, tokenIndex283 := position, tokenIndex
  2336. {
  2337. position284 := position
  2338. if !_rules[ruledigitDual]() {
  2339. goto l283
  2340. }
  2341. add(ruletimeMinute, position284)
  2342. }
  2343. return true
  2344. l283:
  2345. position, tokenIndex = position283, tokenIndex283
  2346. return false
  2347. },
  2348. /* 46 timeSecond <- <digitDual> */
  2349. nil,
  2350. /* 47 timeSecfrac <- <('.' digit+)> */
  2351. nil,
  2352. /* 48 timeNumoffset <- <(('-' / '+') timeHour ':' timeMinute)> */
  2353. nil,
  2354. /* 49 timeOffset <- <('Z' / timeNumoffset)> */
  2355. nil,
  2356. /* 50 partialTime <- <(timeHour ':' timeMinute ':' timeSecond timeSecfrac?)> */
  2357. func() bool {
  2358. position289, tokenIndex289 := position, tokenIndex
  2359. {
  2360. position290 := position
  2361. if !_rules[ruletimeHour]() {
  2362. goto l289
  2363. }
  2364. if buffer[position] != rune(':') {
  2365. goto l289
  2366. }
  2367. position++
  2368. if !_rules[ruletimeMinute]() {
  2369. goto l289
  2370. }
  2371. if buffer[position] != rune(':') {
  2372. goto l289
  2373. }
  2374. position++
  2375. {
  2376. position291 := position
  2377. if !_rules[ruledigitDual]() {
  2378. goto l289
  2379. }
  2380. add(ruletimeSecond, position291)
  2381. }
  2382. {
  2383. position292, tokenIndex292 := position, tokenIndex
  2384. {
  2385. position294 := position
  2386. if buffer[position] != rune('.') {
  2387. goto l292
  2388. }
  2389. position++
  2390. if !_rules[ruledigit]() {
  2391. goto l292
  2392. }
  2393. l295:
  2394. {
  2395. position296, tokenIndex296 := position, tokenIndex
  2396. if !_rules[ruledigit]() {
  2397. goto l296
  2398. }
  2399. goto l295
  2400. l296:
  2401. position, tokenIndex = position296, tokenIndex296
  2402. }
  2403. add(ruletimeSecfrac, position294)
  2404. }
  2405. goto l293
  2406. l292:
  2407. position, tokenIndex = position292, tokenIndex292
  2408. }
  2409. l293:
  2410. add(rulepartialTime, position290)
  2411. }
  2412. return true
  2413. l289:
  2414. position, tokenIndex = position289, tokenIndex289
  2415. return false
  2416. },
  2417. /* 51 fullDate <- <(dateFullYear '-' dateMonth '-' dateMDay)> */
  2418. nil,
  2419. /* 52 fullTime <- <(partialTime timeOffset?)> */
  2420. nil,
  2421. /* 53 datetime <- <((fullDate ('T' fullTime)?) / partialTime)> */
  2422. nil,
  2423. /* 54 digit <- <[0-9]> */
  2424. func() bool {
  2425. position300, tokenIndex300 := position, tokenIndex
  2426. {
  2427. position301 := position
  2428. if c := buffer[position]; c < rune('0') || c > rune('9') {
  2429. goto l300
  2430. }
  2431. position++
  2432. add(ruledigit, position301)
  2433. }
  2434. return true
  2435. l300:
  2436. position, tokenIndex = position300, tokenIndex300
  2437. return false
  2438. },
  2439. /* 55 digitDual <- <(digit digit)> */
  2440. func() bool {
  2441. position302, tokenIndex302 := position, tokenIndex
  2442. {
  2443. position303 := position
  2444. if !_rules[ruledigit]() {
  2445. goto l302
  2446. }
  2447. if !_rules[ruledigit]() {
  2448. goto l302
  2449. }
  2450. add(ruledigitDual, position303)
  2451. }
  2452. return true
  2453. l302:
  2454. position, tokenIndex = position302, tokenIndex302
  2455. return false
  2456. },
  2457. /* 56 digitQuad <- <(digitDual digitDual)> */
  2458. nil,
  2459. /* 57 array <- <('[' Action23 wsnl arrayValues? wsnl ']')> */
  2460. nil,
  2461. /* 58 arrayValues <- <(val Action24 (wsnl comment? wsnl arraySep wsnl comment? wsnl val Action25)* wsnl arraySep? wsnl comment?)> */
  2462. nil,
  2463. /* 59 arraySep <- <','> */
  2464. func() bool {
  2465. position307, tokenIndex307 := position, tokenIndex
  2466. {
  2467. position308 := position
  2468. if buffer[position] != rune(',') {
  2469. goto l307
  2470. }
  2471. position++
  2472. add(rulearraySep, position308)
  2473. }
  2474. return true
  2475. l307:
  2476. position, tokenIndex = position307, tokenIndex307
  2477. return false
  2478. },
  2479. /* 61 Action0 <- <{ _ = buffer }> */
  2480. nil,
  2481. nil,
  2482. /* 63 Action1 <- <{ p.SetTableString(begin, end) }> */
  2483. nil,
  2484. /* 64 Action2 <- <{ p.AddLineCount(end - begin) }> */
  2485. nil,
  2486. /* 65 Action3 <- <{ p.AddLineCount(end - begin) }> */
  2487. nil,
  2488. /* 66 Action4 <- <{ p.AddKeyValue() }> */
  2489. nil,
  2490. /* 67 Action5 <- <{ p.SetKey(p.buffer, begin, end) }> */
  2491. nil,
  2492. /* 68 Action6 <- <{ p.SetKey(p.buffer, begin, end) }> */
  2493. nil,
  2494. /* 69 Action7 <- <{ p.SetTime(begin, end) }> */
  2495. nil,
  2496. /* 70 Action8 <- <{ p.SetFloat64(begin, end) }> */
  2497. nil,
  2498. /* 71 Action9 <- <{ p.SetInt64(begin, end) }> */
  2499. nil,
  2500. /* 72 Action10 <- <{ p.SetString(begin, end) }> */
  2501. nil,
  2502. /* 73 Action11 <- <{ p.SetBool(begin, end) }> */
  2503. nil,
  2504. /* 74 Action12 <- <{ p.SetArray(begin, end) }> */
  2505. nil,
  2506. /* 75 Action13 <- <{ p.SetTable(p.buffer, begin, end) }> */
  2507. nil,
  2508. /* 76 Action14 <- <{ p.SetArrayTable(p.buffer, begin, end) }> */
  2509. nil,
  2510. /* 77 Action15 <- <{ p.StartInlineTable() }> */
  2511. nil,
  2512. /* 78 Action16 <- <{ p.EndInlineTable() }> */
  2513. nil,
  2514. /* 79 Action17 <- <{ p.AddTableKey() }> */
  2515. nil,
  2516. /* 80 Action18 <- <{ p.SetBasicString(p.buffer, begin, end) }> */
  2517. nil,
  2518. /* 81 Action19 <- <{ p.SetMultilineString() }> */
  2519. nil,
  2520. /* 82 Action20 <- <{ p.AddMultilineBasicBody(p.buffer, begin, end) }> */
  2521. nil,
  2522. /* 83 Action21 <- <{ p.SetLiteralString(p.buffer, begin, end) }> */
  2523. nil,
  2524. /* 84 Action22 <- <{ p.SetMultilineLiteralString(p.buffer, begin, end) }> */
  2525. nil,
  2526. /* 85 Action23 <- <{ p.StartArray() }> */
  2527. nil,
  2528. /* 86 Action24 <- <{ p.AddArrayVal() }> */
  2529. nil,
  2530. /* 87 Action25 <- <{ p.AddArrayVal() }> */
  2531. nil,
  2532. }
  2533. p.rules = _rules
  2534. }