parse.peg.go 61 KB

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