Skip to content

Commit

Permalink
lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyadn committed Oct 18, 2023
1 parent 3d3025e commit 151870c
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 136 deletions.
32 changes: 16 additions & 16 deletions src/load/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ class Parser extends CstParser {
{ ALT: () => this.CONSUME(SimpleKey) },
]);
});
private inlineTable = this.RULE('inlineTable', () => {
this.CONSUME(InlineTableOpen);
this.OPTION(() => this.SUBRULE(this.inlineTableKeyValues));
this.CONSUME(InlineTableClose);
});
private value = this.RULE('value', () => {
this.OR([
{ ALT: () => this.CONSUME(TomlString) },
{ ALT: () => this.CONSUME(Boolean) },
{ ALT: () => this.SUBRULE(this.array) },
{ ALT: () => this.SUBRULE(this.inlineTable) },
{ ALT: () => this.CONSUME(DateTime) },
{ ALT: () => this.CONSUME(Float) },
{ ALT: () => this.CONSUME(Integer) },
]);
});
private keyValue = this.RULE('keyValue', () => {
this.SUBRULE(this.key);
this.CONSUME(KeyValueSeparator);
Expand All @@ -48,11 +64,6 @@ class Parser extends CstParser {
DEF: () => this.SUBRULE(this.keyValue),
});
});
private inlineTable = this.RULE('inlineTable', () => {
this.CONSUME(InlineTableOpen);
this.OPTION(() => this.SUBRULE(this.inlineTableKeyValues));
this.CONSUME(InlineTableClose);
});
private arrayValues = this.RULE('arrayValues', () => {
this.SUBRULE(this.value);
let havingMore = true;
Expand All @@ -72,17 +83,6 @@ class Parser extends CstParser {
this.OPTION(() => this.SUBRULE(this.arrayValues));
this.CONSUME(ArrayClose);
});
private value = this.RULE('value', () => {
this.OR([
{ ALT: () => this.CONSUME(TomlString) },
{ ALT: () => this.CONSUME(Boolean) },
{ ALT: () => this.SUBRULE(this.array) },
{ ALT: () => this.SUBRULE(this.inlineTable) },
{ ALT: () => this.CONSUME(DateTime) },
{ ALT: () => this.CONSUME(Float) },
{ ALT: () => this.CONSUME(Integer) },
]);
});
private stdTable = this.RULE('stdTable', () => {
this.CONSUME(StdTableOpen);
this.SUBRULE(this.key);
Expand Down
234 changes: 117 additions & 117 deletions syntax-diagram.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,55 +89,6 @@
}
]
},
{
"type": "Rule",
"name": "keyValue",
"orgText": "",
"definition": [
{
"type": "NonTerminal",
"name": "key",
"idx": 0
},
{
"type": "Terminal",
"name": "KeyValueSeparator",
"label": "=",
"idx": 0,
"pattern": "="
},
{
"type": "NonTerminal",
"name": "value",
"idx": 0
}
]
},
{
"type": "Rule",
"name": "inlineTableKeyValues",
"orgText": "",
"definition": [
{
"type": "RepetitionWithSeparator",
"idx": 0,
"separator": {
"type": "Terminal",
"name": "InlineTableSep",
"label": ",",
"idx": 1,
"pattern": ","
},
"definition": [
{
"type": "NonTerminal",
"name": "keyValue",
"idx": 0
}
]
}
]
},
{
"type": "Rule",
"name": "inlineTable",
Expand Down Expand Up @@ -170,74 +121,6 @@
}
]
},
{
"type": "Rule",
"name": "arrayValues",
"orgText": "",
"definition": [
{
"type": "NonTerminal",
"name": "value",
"idx": 0
},
{
"type": "Repetition",
"idx": 0,
"definition": [
{
"type": "Terminal",
"name": "Comma",
"label": ",",
"idx": 0,
"pattern": ","
},
{
"type": "Option",
"idx": 0,
"definition": [
{
"type": "NonTerminal",
"name": "value",
"idx": 1
}
]
}
]
}
]
},
{
"type": "Rule",
"name": "array",
"orgText": "",
"definition": [
{
"type": "Terminal",
"name": "ArrayOpen",
"label": "[",
"idx": 0,
"pattern": "\\["
},
{
"type": "Option",
"idx": 0,
"definition": [
{
"type": "NonTerminal",
"name": "arrayValues",
"idx": 0
}
]
},
{
"type": "Terminal",
"name": "ArrayClose",
"label": "]",
"idx": 0,
"pattern": "]"
}
]
},
{
"type": "Rule",
"name": "value",
Expand Down Expand Up @@ -331,6 +214,123 @@
}
]
},
{
"type": "Rule",
"name": "keyValue",
"orgText": "",
"definition": [
{
"type": "NonTerminal",
"name": "key",
"idx": 0
},
{
"type": "Terminal",
"name": "KeyValueSeparator",
"label": "=",
"idx": 0,
"pattern": "="
},
{
"type": "NonTerminal",
"name": "value",
"idx": 0
}
]
},
{
"type": "Rule",
"name": "inlineTableKeyValues",
"orgText": "",
"definition": [
{
"type": "RepetitionWithSeparator",
"idx": 0,
"separator": {
"type": "Terminal",
"name": "InlineTableSep",
"label": ",",
"idx": 1,
"pattern": ","
},
"definition": [
{
"type": "NonTerminal",
"name": "keyValue",
"idx": 0
}
]
}
]
},
{
"type": "Rule",
"name": "arrayValues",
"orgText": "",
"definition": [
{
"type": "NonTerminal",
"name": "value",
"idx": 0
},
{
"type": "Repetition",
"idx": 0,
"definition": [
{
"type": "Terminal",
"name": "Comma",
"label": ",",
"idx": 0,
"pattern": ","
},
{
"type": "Option",
"idx": 0,
"definition": [
{
"type": "NonTerminal",
"name": "value",
"idx": 1
}
]
}
]
}
]
},
{
"type": "Rule",
"name": "array",
"orgText": "",
"definition": [
{
"type": "Terminal",
"name": "ArrayOpen",
"label": "[",
"idx": 0,
"pattern": "\\["
},
{
"type": "Option",
"idx": 0,
"definition": [
{
"type": "NonTerminal",
"name": "arrayValues",
"idx": 0
}
]
},
{
"type": "Terminal",
"name": "ArrayClose",
"label": "]",
"idx": 0,
"pattern": "]"
}
]
},
{
"type": "Rule",
"name": "stdTable",
Expand Down
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"compilerOptions": {
"moduleResolution": "nodenext",
"types": [
"vitest/globals"
],
"types": ["vitest/globals"],
"allowSyntheticDefaultImports": true
},
"exclude": ["node_modules"]
Expand Down

0 comments on commit 151870c

Please sign in to comment.