@rip-lang/schema 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1042 -0
- package/SCHEMA.md +1113 -0
- package/emit-sql.js +460 -0
- package/emit-types.js +366 -0
- package/generate.js +144 -0
- package/grammar.rip +504 -0
- package/index.js +39 -0
- package/lexer.js +438 -0
- package/orm.js +916 -0
- package/package.json +62 -0
- package/parser.js +246 -0
- package/runtime.js +494 -0
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rip-lang/schema",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Unified schema language for types, validation, database models, UI widgets, and reactive state",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"rip-schema": "./generate.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./index.js",
|
|
12
|
+
"./runtime": "./runtime.js",
|
|
13
|
+
"./orm": "./orm.js",
|
|
14
|
+
"./lexer": "./lexer.js",
|
|
15
|
+
"./parser": "./parser.js",
|
|
16
|
+
"./emit-types": "./emit-types.js",
|
|
17
|
+
"./emit-sql": "./emit-sql.js"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"parser": "bun ../../src/grammar/solar.rip -o parser.js grammar.rip",
|
|
21
|
+
"generate": "bun generate.js",
|
|
22
|
+
"test": "bun test/test-generators.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"schema",
|
|
26
|
+
"validation",
|
|
27
|
+
"types",
|
|
28
|
+
"database",
|
|
29
|
+
"orm",
|
|
30
|
+
"forms",
|
|
31
|
+
"ui",
|
|
32
|
+
"state",
|
|
33
|
+
"rip"
|
|
34
|
+
],
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/shreeve/rip-lang.git",
|
|
38
|
+
"directory": "packages/schema"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/shreeve/rip-lang/tree/main/packages/schema#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/shreeve/rip-lang/issues"
|
|
43
|
+
},
|
|
44
|
+
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"rip-lang": "^3.10.0"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"index.js",
|
|
51
|
+
"runtime.js",
|
|
52
|
+
"orm.js",
|
|
53
|
+
"lexer.js",
|
|
54
|
+
"parser.js",
|
|
55
|
+
"emit-types.js",
|
|
56
|
+
"emit-sql.js",
|
|
57
|
+
"generate.js",
|
|
58
|
+
"grammar.rip",
|
|
59
|
+
"README.md",
|
|
60
|
+
"SCHEMA.md"
|
|
61
|
+
]
|
|
62
|
+
}
|
package/parser.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// Schema Parser - Generated by Solar
|
|
2
|
+
// DO NOT EDIT - This file is auto-generated from packages/schema/grammar.rip
|
|
3
|
+
|
|
4
|
+
import { SchemaLexer } from './lexer.js';
|
|
5
|
+
|
|
6
|
+
// ES6 Parser generated by Solar 1.5.0
|
|
7
|
+
|
|
8
|
+
const parserInstance = {
|
|
9
|
+
symbolIds: {"$accept":0,"$end":1,"error":2,"Schema":3,"Definitions":4,"Definition":5,"TERMINATOR":6,"Import":7,"EnumDef":8,"TypeDef":9,"ModelDef":10,"MixinDef":11,"WidgetDef":12,"FormDef":13,"StateDef":14,"IMPORT":15,"STRING":16,"Block":17,"INDENT":18,"Body":19,"OUTDENT":20,"ENUM":21,"Identifier":22,":":23,"EnumValues":24,"EnumMembers":25,",":26,"EnumMember":27,"Literal":28,"TYPE":29,"MODEL":30,"MIXIN":31,"WIDGET":32,"FORM":33,"STATE":34,"Member":35,"Field":36,"Directive":37,"Relation":38,"IndexDef":39,"ComputedBlock":40,"ValidateBlock":41,"EventsDef":42,"ActionsBlock":43,"FormField":44,"IDENTIFIER":45,"FieldType":46,"Constraints":47,"Attrs":48,"FieldModifiers":49,"ArrowFunc":50,"!":51,"#":52,"?":53,"[":54,"]":55,"ConstraintList":56,"ConstraintValue":57,"Object":58,"Array":59,"Regex":60,"TIMESTAMPS":61,"SOFT_DELETE":62,"INCLUDE":63,"PATTERN":64,"BELONGS_TO":65,"RelationOpts":66,"HAS_ONE":67,"HAS_MANY":68,"ONE":69,"MANY":70,"LINK":71,"INDEX":72,"IndexFields":73,"COMPUTED":74,"VALIDATE":75,"EVENTS":76,"EventList":77,"ACTIONS":78,"NUMBER":79,"BOOL":80,"NULL":81,"UNDEFINED":82,"REGEX":83,"{":84,"}":85,"ObjectEntries":86,"ObjectEntry":87,"OptComma":88,"Value":89,"...":90,"ArrayItems":91,"->":92,"(":93,"Params":94,")":95,"Primary":96,".":97,"?.":98,"Args":99,"BinOp":100,"UnaryOp":101,"@":102,"+":103,"-":104,"*":105,"/":106,"==":107,"!=":108,"<":109,">":110,"<=":111,">=":112,"&&":113,"||":114,"??":115,"IS":116,"ISNT":117,"NOT":118},
|
|
10
|
+
tokenNames: {2:"error",6:"TERMINATOR",15:"IMPORT",16:"STRING",18:"INDENT",20:"OUTDENT",21:"ENUM",23:":",26:",",29:"TYPE",30:"MODEL",31:"MIXIN",32:"WIDGET",33:"FORM",34:"STATE",45:"IDENTIFIER",51:"!",52:"#",53:"?",54:"[",55:"]",61:"TIMESTAMPS",62:"SOFT_DELETE",63:"INCLUDE",64:"PATTERN",65:"BELONGS_TO",67:"HAS_ONE",68:"HAS_MANY",69:"ONE",70:"MANY",71:"LINK",72:"INDEX",74:"COMPUTED",75:"VALIDATE",76:"EVENTS",78:"ACTIONS",79:"NUMBER",80:"BOOL",81:"NULL",82:"UNDEFINED",83:"REGEX",84:"{",85:"}",90:"...",92:"->",93:"(",95:")",97:".",98:"?.",102:"@",103:"+",104:"-",105:"*",106:"/",107:"==",108:"!=",109:"<",110:">",111:"<=",112:">=",113:"&&",114:"||",115:"??",116:"IS",117:"ISNT",118:"NOT"},
|
|
11
|
+
parseTable: (()=>{let d=[20,1,2,1,1,2,1,1,1,1,1,1,1,1,6,8,1,1,1,1,1,-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,1,1,0,2,1,5,-2,20,2,1,5,-3,-3,2,1,5,-6,-6,2,1,5,-7,-7,2,1,5,-8,-8,2,1,5,-9,-9,2,1,5,-10,-10,2,1,5,-11,-11,2,1,5,-12,-12,2,1,5,-13,-13,1,16,21,2,22,23,22,23,2,22,23,24,23,2,22,23,25,23,2,22,23,26,23,2,22,23,27,23,2,22,23,28,23,2,22,23,29,23,19,1,4,1,1,1,1,1,1,1,1,1,1,6,8,1,1,1,1,1,-5,30,-5,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2,1,5,-14,-14,3,6,12,5,33,32,31,5,1,5,12,5,3,-104,-104,-104,-104,-104,4,6,11,1,5,37,34,36,35,4,6,11,1,5,37,38,36,39,3,6,11,1,37,40,36,4,6,11,1,5,37,41,36,42,1,23,43,3,6,11,1,37,44,36,2,1,5,-4,-4,3,22,2,21,46,45,23,4,22,3,2,18,49,47,48,23,1,18,50,2,1,5,-26,-26,2,22,23,51,23,27,19,16,1,1,1,1,1,1,1,1,1,1,16,1,1,1,1,2,1,1,1,1,1,2,1,1,2,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,1,18,79,2,1,5,-28,-28,2,22,23,80,23,2,1,5,-30,-30,2,1,5,-31,-31,2,22,23,81,23,2,22,23,82,23,2,1,5,-34,-34,3,1,5,20,-17,-17,83,3,1,5,20,-20,-20,-20,2,6,14,85,84,2,6,14,-22,-22,1,23,86,4,22,3,2,18,49,87,48,23,3,6,11,1,37,88,36,2,6,14,90,89,2,6,14,-35,-35,2,6,14,-38,-38,2,6,14,-39,-39,2,6,14,-40,-40,2,6,14,-41,-41,2,6,14,-42,-42,2,6,14,-43,-43,2,6,14,-44,-44,2,6,14,-45,-45,2,6,14,-46,-46,11,45,1,3,1,1,1,1,5,26,8,1,95,91,92,93,96,97,98,94,101,99,100,2,6,14,-74,-74,2,6,14,-75,-75,1,45,102,2,60,23,103,104,1,45,105,1,45,106,1,45,107,1,45,108,1,45,109,1,16,110,2,45,9,111,112,3,6,11,1,37,113,36,3,6,11,1,37,114,36,2,45,32,116,115,3,6,11,1,37,117,36,27,19,16,1,1,1,1,1,1,1,1,1,1,16,1,1,1,1,2,1,1,1,1,1,2,1,1,2,118,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,3,6,11,1,37,119,36,3,6,11,1,37,120,36,3,6,11,1,37,121,36,2,22,23,122,23,2,1,5,-18,-18,5,6,14,2,5,18,-24,-24,49,123,23,6,16,12,51,1,1,1,126,124,125,127,128,129,2,6,14,85,130,2,1,5,-27,-27,3,1,5,14,-15,-15,-15,28,6,14,15,1,1,1,1,1,1,1,1,1,1,16,1,1,1,1,2,1,1,1,1,1,2,1,1,2,-37,-37,131,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,3,6,14,6,-47,-47,132,5,45,1,5,1,1,95,133,134,135,136,2,6,14,-55,-55,2,6,14,-103,-103,4,6,14,6,28,-62,-62,-62,137,4,45,6,1,1,-56,-56,-56,-56,4,45,6,1,1,-57,-57,-57,-57,4,45,6,1,1,-58,-58,-58,-58,24,16,2,10,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,139,143,144,148,151,153,145,146,147,125,127,128,129,104,101,138,99,142,140,141,149,152,150,4,26,19,49,1,-134,155,154,-134,7,16,2,27,40,1,1,3,161,159,160,156,157,158,162,2,6,14,-76,-76,2,6,14,-77,-77,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,-110,3,6,14,6,-78,-78,163,3,6,14,6,-80,-80,164,3,6,14,6,-82,-82,165,3,6,14,6,-84,-84,166,3,6,14,6,-86,-86,167,1,26,168,3,6,14,32,-91,-91,169,2,45,28,171,170,2,6,14,-97,-97,2,6,14,-98,-98,3,6,14,6,-99,-99,172,3,6,14,6,-100,-100,-100,2,6,14,-102,-102,2,6,14,90,173,2,1,5,-29,-29,2,1,5,-32,-32,2,1,5,-33,-33,3,1,5,20,-21,-21,-21,2,6,14,-23,-23,2,6,14,-25,-25,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,-105,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,-107,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,-109,2,1,5,-19,-19,2,6,14,-36,-36,5,47,1,6,4,26,174,175,176,177,101,3,6,14,6,-51,-51,178,4,45,6,1,1,-59,-59,-59,-59,4,45,6,1,1,-60,-60,-60,-60,4,45,6,1,1,-61,-61,-61,-61,1,55,179,26,6,14,6,28,1,30,8,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,184,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,-130,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,200,99,142,140,141,149,152,150,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,-137,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,201,99,142,140,141,149,152,150,26,16,10,2,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,1,1,1,5,1,2,14,126,-134,143,203,148,151,153,145,146,147,125,127,128,129,104,101,202,99,142,154,-134,140,141,149,152,150,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,-146,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,-148,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,-149,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,26,6,14,6,19,9,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-153,-153,-153,204,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,-153,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,-171,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,-172,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,-173,25,16,12,17,5,1,3,1,3,1,1,19,1,1,1,1,1,5,2,1,1,3,5,1,2,14,126,143,144,148,151,153,205,145,146,147,125,127,128,129,104,101,207,206,99,142,140,141,149,152,150,2,26,69,209,208,2,26,69,-135,-135,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,-111,5,6,14,6,59,3,-122,-122,211,210,212,4,6,14,6,59,-113,-113,-113,-113,6,16,2,27,41,1,3,161,159,160,213,158,162,5,6,14,3,3,59,-118,-118,214,-118,-118,1,23,215,1,45,216,3,58,8,18,218,217,101,3,58,8,18,218,219,101,3,58,8,18,218,220,101,3,58,8,18,218,221,101,3,58,8,18,218,222,101,1,45,223,2,6,14,-92,-92,2,26,29,225,224,2,26,29,-95,-95,1,45,226,3,1,5,14,-16,-16,-16,3,6,14,6,-48,-48,227,2,6,14,-49,-49,18,16,12,17,5,4,2,1,1,1,1,19,1,1,1,1,1,8,1,126,230,231,235,153,228,229,232,233,234,125,127,128,129,104,101,99,100,2,6,14,-73,-73,5,47,1,6,4,26,236,237,176,177,101,3,6,14,6,-63,-63,-63,1,45,238,1,45,239,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,240,99,142,140,141,149,152,150,25,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,2,1,3,2,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,243,99,142,241,140,242,141,149,152,150,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,244,99,142,140,141,149,152,150,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,-156,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,-157,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,-158,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,-159,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,-160,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,-161,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,-162,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,-163,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,-164,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,-165,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,-166,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,-167,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,-168,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,-169,15,16,29,6,3,25,1,1,1,1,1,8,1,9,2,14,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,-170,21,20,34,39,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,245,182,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,26,6,14,6,28,1,30,8,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-144,-144,-144,-144,-144,-144,-144,-144,-144,-144,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,21,54,39,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,182,183,246,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-147,-147,-135,-147,-147,-147,-147,-135,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,-147,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,-152,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,5,6,14,6,29,33,-122,-122,248,247,249,23,6,20,28,1,38,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-126,-126,182,-126,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,1,92,250,1,45,251,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,-112,6,6,10,4,25,42,3,-123,161,-123,160,252,162,1,6,253,4,6,14,6,62,-122,-122,211,254,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,255,99,142,140,141,149,152,150,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,256,99,142,140,141,149,152,150,4,6,14,6,59,-121,-121,-121,-121,2,6,14,-79,-79,2,6,14,-90,-90,2,6,14,-81,-81,2,6,14,-83,-83,2,6,14,-85,-85,2,6,14,-87,-87,3,6,14,6,-88,-88,257,3,6,14,32,-93,-93,258,1,45,259,3,6,14,6,-101,-101,-101,3,48,10,26,260,177,101,2,26,29,262,261,2,26,29,-65,-65,2,26,29,-67,-67,2,26,29,-68,-68,2,26,29,-69,-69,2,26,29,-70,-70,2,26,29,-71,-71,2,26,29,-72,-72,3,6,14,6,-52,-52,263,2,6,14,-53,-53,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,-138,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,-139,21,54,1,38,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,182,264,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,-141,2,26,69,266,265,22,26,28,39,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-154,182,183,-154,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,26,6,14,6,28,1,30,8,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-143,-143,-143,182,-143,-143,183,-143,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,-131,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,-145,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,25,6,10,4,8,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,-123,126,-123,143,144,148,151,153,145,146,147,125,127,128,129,104,101,267,99,142,140,141,149,152,150,1,6,268,24,16,2,10,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,270,143,144,148,151,153,145,146,147,125,127,128,129,104,101,269,99,142,140,141,149,152,150,2,26,69,-136,-136,4,6,14,6,59,-114,-114,-114,-114,8,6,10,4,6,19,40,2,3,-116,161,-116,-116,160,-116,271,162,2,6,14,253,272,24,6,14,6,28,31,8,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-119,-119,-119,182,-119,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,24,6,14,6,28,31,8,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-120,-120,-120,182,-120,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,3,58,8,18,218,273,101,2,6,14,-94,-94,2,26,29,-96,-96,2,6,14,-50,-50,3,6,14,6,-64,-64,-64,17,16,12,17,5,4,3,1,1,1,19,1,1,1,1,1,8,1,126,230,231,235,153,274,232,233,234,125,127,128,129,104,101,99,100,3,48,10,26,275,177,101,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,-140,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,-142,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,276,99,142,140,141,149,152,150,23,6,20,28,1,38,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-127,-127,182,-127,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,26,6,10,10,2,17,5,1,3,1,3,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,-129,126,-129,143,144,148,151,153,-129,145,146,147,125,127,128,129,104,101,277,99,142,140,141,149,152,150,26,6,14,6,28,1,30,8,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,184,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,23,16,12,17,5,1,3,4,1,1,19,1,1,1,1,1,5,3,1,3,5,1,2,14,126,143,144,148,151,153,145,146,147,125,127,128,129,104,101,278,99,142,140,141,149,152,150,4,6,14,6,59,-115,-115,-115,-115,4,6,14,6,59,-117,-117,-117,-117,2,6,14,-89,-89,2,26,29,-66,-66,2,6,14,-54,-54,22,26,28,39,2,2,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-155,182,183,-155,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,23,6,20,28,1,38,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-128,-128,182,-128,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,21,20,34,39,4,1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,279,182,183,180,181,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,25,6,14,6,28,1,30,8,2,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133,-133],t=[],p=0,n,o,k,a;while(p<d.length){n=d[p++];o={};k=0;a=[];while(n--)k+=d[p++],a.push(k);for(k of a)o[k]=d[p++];t.push(o)}return t})(),
|
|
12
|
+
ruleTable: [0,0,3,0,3,1,4,1,4,3,4,2,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,7,2,17,3,17,4,8,4,8,5,8,6,24,1,24,3,25,1,25,3,25,2,27,3,9,3,9,5,10,3,10,5,11,3,12,3,12,5,13,5,14,3,19,1,19,3,19,2,35,1,35,1,35,1,35,1,35,1,35,1,35,1,35,1,35,1,36,2,36,4,36,4,36,6,36,3,36,5,36,5,36,7,36,2,49,1,49,1,49,1,49,2,49,2,49,2,46,1,46,3,47,3,56,1,56,3,57,1,57,1,57,1,57,1,57,1,57,1,48,1,37,1,37,1,37,2,37,2,38,2,38,4,38,2,38,4,38,2,38,4,38,2,38,4,38,2,38,4,38,4,38,6,66,1,39,2,39,3,39,4,39,5,73,1,73,3,40,2,41,2,42,2,77,1,77,3,43,2,44,2,22,1,28,1,28,1,28,1,28,1,28,1,60,1,58,2,58,3,86,1,86,3,86,4,86,3,86,4,87,1,87,3,87,3,87,2,88,0,88,1,59,2,59,3,91,1,91,3,91,4,91,3,50,2,50,4,50,5,50,7,94,0,94,1,94,3,89,1,89,3,89,3,89,4,89,3,89,4,89,3,89,2,89,3,96,1,96,1,96,1,96,1,96,1,96,1,96,2,96,1,99,1,99,3,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,1,101,1,101,1,101,1],
|
|
13
|
+
ruleActions: (rule, vals, locs, shared) => {
|
|
14
|
+
const $ = vals;
|
|
15
|
+
const $0 = vals.length - 1;
|
|
16
|
+
switch (rule) {
|
|
17
|
+
case 1: return ["schema"];
|
|
18
|
+
case 2: return ["schema", ...$[$0]];
|
|
19
|
+
case 3: case 20: case 22: case 35: case 65: case 95: case 100: case 113: case 126: case 135: case 154: return [$[$0]];
|
|
20
|
+
case 4: case 21: case 23: case 36: case 66: case 96: case 101: case 114: case 127: case 136: case 155: return [...$[$0-2], $[$0]];
|
|
21
|
+
case 5: case 15: case 16: case 24: case 37: case 64: case 145: return $[$0-1];
|
|
22
|
+
case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 62: case 67: case 68: case 69: case 70: case 71: case 72: case 73: case 90: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 122: case 123: case 137: case 146: case 147: case 148: case 149: case 150: case 151: return $[$0];
|
|
23
|
+
case 14: return ["import", $[$0]];
|
|
24
|
+
case 17: return ["enum", $[$0-2], $[$0]];
|
|
25
|
+
case 18: return ["enum", $[$0-3], $[$0-1]];
|
|
26
|
+
case 19: return ["enum", $[$0-4], $[$0-1]];
|
|
27
|
+
case 25: case 119: case 120: return [$[$0-2], $[$0]];
|
|
28
|
+
case 26: return ["type", $[$0-1], null, $[$0]];
|
|
29
|
+
case 27: return ["type", $[$0-3], $[$0-1], $[$0]];
|
|
30
|
+
case 28: return ["model", $[$0-1], null, $[$0]];
|
|
31
|
+
case 29: return ["model", $[$0-3], $[$0-1], $[$0]];
|
|
32
|
+
case 30: return ["mixin", $[$0-1], $[$0]];
|
|
33
|
+
case 31: return ["widget", $[$0-1], null, $[$0]];
|
|
34
|
+
case 32: return ["widget", $[$0-3], $[$0-1], $[$0]];
|
|
35
|
+
case 33: return ["form", $[$0-3], $[$0-1], $[$0]];
|
|
36
|
+
case 34: return ["state", $[$0-1], $[$0]];
|
|
37
|
+
case 47: return ["field", $[$0-1], [], $[$0], null, null];
|
|
38
|
+
case 48: return ["field", $[$0-3], [], $[$0-2], $[$0], null];
|
|
39
|
+
case 49: return ["field", $[$0-3], [], $[$0-2], null, $[$0]];
|
|
40
|
+
case 50: return ["field", $[$0-5], [], $[$0-4], $[$0-2], $[$0]];
|
|
41
|
+
case 51: return ["field", $[$0-2], $[$0-1], $[$0], null, null];
|
|
42
|
+
case 52: return ["field", $[$0-4], $[$0-3], $[$0-2], $[$0], null];
|
|
43
|
+
case 53: return ["field", $[$0-4], $[$0-3], $[$0-2], null, $[$0]];
|
|
44
|
+
case 54: return ["field", $[$0-6], $[$0-5], $[$0-4], $[$0-2], $[$0]];
|
|
45
|
+
case 55: return ["computed", $[$0-1], $[$0]];
|
|
46
|
+
case 56: return ["!"];
|
|
47
|
+
case 57: return ["#"];
|
|
48
|
+
case 58: return ["?"];
|
|
49
|
+
case 59: return [...$[$0-1], "!"];
|
|
50
|
+
case 60: return [...$[$0-1], "#"];
|
|
51
|
+
case 61: return [...$[$0-1], "?"];
|
|
52
|
+
case 63: return ["array", $[$0-2]];
|
|
53
|
+
case 74: return ["timestamps"];
|
|
54
|
+
case 75: return ["softDelete"];
|
|
55
|
+
case 76: return ["include", $[$0]];
|
|
56
|
+
case 77: return ["pattern", $[$0]];
|
|
57
|
+
case 78: return ["belongs_to", $[$0], null];
|
|
58
|
+
case 79: return ["belongs_to", $[$0-2], $[$0]];
|
|
59
|
+
case 80: case 84: return ["has_one", $[$0], null];
|
|
60
|
+
case 81: case 85: return ["has_one", $[$0-2], $[$0]];
|
|
61
|
+
case 82: case 86: return ["has_many", $[$0], null];
|
|
62
|
+
case 83: case 87: return ["has_many", $[$0-2], $[$0]];
|
|
63
|
+
case 88: return ["link", $[$0-2], $[$0], null];
|
|
64
|
+
case 89: return ["link", $[$0-4], $[$0-2], $[$0]];
|
|
65
|
+
case 91: return ["index", [$[$0]], false];
|
|
66
|
+
case 92: return ["index", [$[$0-1]], true];
|
|
67
|
+
case 93: return ["index", $[$0-1], false];
|
|
68
|
+
case 94: return ["index", $[$0-2], true];
|
|
69
|
+
case 97: return ["computed", $[$0]];
|
|
70
|
+
case 98: return ["validate", $[$0]];
|
|
71
|
+
case 99: return ["events", $[$0]];
|
|
72
|
+
case 102: return ["actions", $[$0]];
|
|
73
|
+
case 103: return ["placement", $[$0-1], $[$0]];
|
|
74
|
+
case 111: return ["object"];
|
|
75
|
+
case 112: return ["object", ...$[$0-1]];
|
|
76
|
+
case 115: case 128: return [...$[$0-3], $[$0]];
|
|
77
|
+
case 116: case 117: case 129: return $[$0-2];
|
|
78
|
+
case 118: return [$[$0], $[$0]];
|
|
79
|
+
case 121: return ["...", $[$0]];
|
|
80
|
+
case 124: return ["array"];
|
|
81
|
+
case 125: return ["array", ...$[$0-1]];
|
|
82
|
+
case 130: return ["->", [], $[$0]];
|
|
83
|
+
case 131: return ["->", [], $[$0-1]];
|
|
84
|
+
case 132: return ["->", $[$0-3], $[$0]];
|
|
85
|
+
case 133: return ["->", $[$0-5], $[$0-1]];
|
|
86
|
+
case 134: return [];
|
|
87
|
+
case 138: return [".", $[$0-2], $[$0]];
|
|
88
|
+
case 139: return ["?.", $[$0-2], $[$0]];
|
|
89
|
+
case 140: return ["[]", $[$0-3], $[$0-1]];
|
|
90
|
+
case 141: return ["call", $[$0-2], []];
|
|
91
|
+
case 142: return ["call", $[$0-3], $[$0-1]];
|
|
92
|
+
case 143: return [$[$0-1], $[$0-2], $[$0]];
|
|
93
|
+
case 144: return [$[$0-1], $[$0]];
|
|
94
|
+
case 152: return [".", "this", $[$0]];
|
|
95
|
+
case 153: return "this";
|
|
96
|
+
case 156: return "+";
|
|
97
|
+
case 157: case 173: return "-";
|
|
98
|
+
case 158: return "*";
|
|
99
|
+
case 159: return "/";
|
|
100
|
+
case 160: return "==";
|
|
101
|
+
case 161: return "!=";
|
|
102
|
+
case 162: return "<";
|
|
103
|
+
case 163: return ">";
|
|
104
|
+
case 164: return "<=";
|
|
105
|
+
case 165: return ">=";
|
|
106
|
+
case 166: return "&&";
|
|
107
|
+
case 167: return "||";
|
|
108
|
+
case 168: return "??";
|
|
109
|
+
case 169: return "is";
|
|
110
|
+
case 170: return "isnt";
|
|
111
|
+
case 171: return "not";
|
|
112
|
+
case 172: return "!";
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
parseError(str, hash) {
|
|
116
|
+
let col, error, line, location, message, text, token;
|
|
117
|
+
if (hash.recoverable)
|
|
118
|
+
return this.trace(str);
|
|
119
|
+
else {
|
|
120
|
+
line = (hash.line || 0) + 1;
|
|
121
|
+
col = hash.loc?.c || 0;
|
|
122
|
+
token = hash.token ? ` (token: ${hash.token})` : "";
|
|
123
|
+
text = hash.text ? ` near '${hash.text}'` : "";
|
|
124
|
+
location = `line ${line}, column ${col}`;
|
|
125
|
+
message = `Parse error at ${location}${token}${text}: ${str}`;
|
|
126
|
+
error = Error(message);
|
|
127
|
+
error.hash = hash;
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
parse(input) {
|
|
132
|
+
let EOF, TERROR, action, errStr, expected, len, lex, lexer, loc, locs, newState, p, parseTable, preErrorSymbol, r, recovering, rv, sharedState, state, stk, symbol, tokenLen, tokenLine, tokenLoc, tokenText, vals;
|
|
133
|
+
[stk, vals, locs] = [[0], [null], []];
|
|
134
|
+
[parseTable, tokenText, tokenLine, tokenLen, recovering] = [this.parseTable, "", 0, 0, 0];
|
|
135
|
+
[TERROR, EOF] = [2, 1];
|
|
136
|
+
lexer = Object.create(this.lexer);
|
|
137
|
+
sharedState = { ctx: {} };
|
|
138
|
+
for (const k in this.ctx) {
|
|
139
|
+
if (!Object.hasOwn(this.ctx, k))
|
|
140
|
+
continue;
|
|
141
|
+
const v = this.ctx[k];
|
|
142
|
+
sharedState.ctx[k] = v;
|
|
143
|
+
}
|
|
144
|
+
lexer.setInput(input, sharedState.ctx);
|
|
145
|
+
[sharedState.ctx.lexer, sharedState.ctx.parser] = [lexer, this];
|
|
146
|
+
if (lexer.loc == null)
|
|
147
|
+
lexer.loc = {};
|
|
148
|
+
tokenLoc = lexer.loc;
|
|
149
|
+
locs.push(tokenLoc);
|
|
150
|
+
this.parseError = typeof sharedState.ctx.parseError === "function" ? sharedState.ctx.parseError : Object.getPrototypeOf(this).parseError;
|
|
151
|
+
lex = () => {
|
|
152
|
+
let token;
|
|
153
|
+
token = lexer.lex() || EOF;
|
|
154
|
+
if (typeof token !== "number")
|
|
155
|
+
token = this.symbolIds[token] || token;
|
|
156
|
+
return token;
|
|
157
|
+
};
|
|
158
|
+
symbol = preErrorSymbol = state = action = r = p = len = newState = expected = null;
|
|
159
|
+
rv = {};
|
|
160
|
+
while (!0) {
|
|
161
|
+
state = stk[stk.length - 1];
|
|
162
|
+
if (symbol == null)
|
|
163
|
+
symbol = lex();
|
|
164
|
+
action = parseTable[state]?.[symbol];
|
|
165
|
+
if (action == null) {
|
|
166
|
+
errStr = "";
|
|
167
|
+
if (!recovering)
|
|
168
|
+
expected = (() => {
|
|
169
|
+
const result = [];
|
|
170
|
+
for (const p in parseTable[state]) {
|
|
171
|
+
if (!Object.hasOwn(parseTable[state], p))
|
|
172
|
+
continue;
|
|
173
|
+
if (this.tokenNames[p] && p > TERROR)
|
|
174
|
+
result.push(`'${this.tokenNames[p]}'`);
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
})();
|
|
178
|
+
errStr = (() => {
|
|
179
|
+
if (lexer.showPosition)
|
|
180
|
+
return `Parse error on line ${tokenLine + 1}:
|
|
181
|
+
${lexer.showPosition()}
|
|
182
|
+
Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
183
|
+
else {
|
|
184
|
+
`Parse error on line ${tokenLine + 1}: Unexpected ${symbol === EOF ? "end of input" : `'${this.tokenNames[symbol] || symbol}'`}`;
|
|
185
|
+
return this.parseError(errStr, { text: lexer.match, token: this.tokenNames[symbol] || symbol, line: lexer.line, loc: tokenLoc, expected });
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
throw Error(errStr);
|
|
189
|
+
}
|
|
190
|
+
if (action > 0) {
|
|
191
|
+
stk.push(symbol, action);
|
|
192
|
+
vals.push(lexer.text);
|
|
193
|
+
locs.push(lexer.loc);
|
|
194
|
+
symbol = null;
|
|
195
|
+
if (!preErrorSymbol) {
|
|
196
|
+
[tokenLen, tokenText, tokenLine, tokenLoc] = [lexer.len, lexer.text, lexer.line, lexer.loc];
|
|
197
|
+
if (recovering > 0)
|
|
198
|
+
recovering--;
|
|
199
|
+
} else
|
|
200
|
+
[symbol, preErrorSymbol] = [preErrorSymbol, null];
|
|
201
|
+
} else if (action < 0) {
|
|
202
|
+
len = this.ruleTable[-action * 2 + 1];
|
|
203
|
+
rv.$ = vals[vals.length - len];
|
|
204
|
+
loc = locs[locs.length - (len || 1)];
|
|
205
|
+
rv._$ = { r: loc.r, c: loc.c };
|
|
206
|
+
r = this.ruleActions.call(rv, -action, vals, locs, sharedState.ctx);
|
|
207
|
+
if (r != null)
|
|
208
|
+
rv.$ = r;
|
|
209
|
+
if (Array.isArray(rv.$))
|
|
210
|
+
rv.$.loc = rv._$;
|
|
211
|
+
if (len) {
|
|
212
|
+
stk.length -= len * 2;
|
|
213
|
+
vals.length -= len;
|
|
214
|
+
locs.length -= len;
|
|
215
|
+
}
|
|
216
|
+
stk.push(this.ruleTable[-action * 2]);
|
|
217
|
+
vals.push(rv.$);
|
|
218
|
+
locs.push(rv._$);
|
|
219
|
+
newState = parseTable[stk[stk.length - 2]][stk[stk.length - 1]];
|
|
220
|
+
stk.push(newState);
|
|
221
|
+
} else if (action === 0)
|
|
222
|
+
return vals[vals.length - 1];
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
trace() {},
|
|
226
|
+
ctx: {},
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const createParser = (init = {}) => {
|
|
230
|
+
const p = Object.create(parserInstance);
|
|
231
|
+
Object.defineProperty(p, "ctx", {
|
|
232
|
+
value: { ...init },
|
|
233
|
+
enumerable: false,
|
|
234
|
+
writable: true,
|
|
235
|
+
configurable: true,
|
|
236
|
+
})
|
|
237
|
+
return p
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const parser = /*#__PURE__*/createParser()
|
|
241
|
+
parser.lexer = new SchemaLexer()
|
|
242
|
+
|
|
243
|
+
export { parser }
|
|
244
|
+
export const Parser = createParser
|
|
245
|
+
export const parse = parser.parse.bind(parser)
|
|
246
|
+
export default parser
|