Update syntax

This commit is contained in:
Jeff 2023-10-05 08:03:37 -04:00
parent bcc3557b77
commit 0797a60677
5 changed files with 8077 additions and 8161 deletions

@ -1 +1 @@
Subproject commit a42b43ed7853b73e8bb42b0ab23765acc1fc78c1 Subproject commit 7fa5dd0f54e389052274affd8237040af545b938

View File

@ -8,7 +8,7 @@ module.exports = grammar({
item: $ => choice( item: $ => choice(
$.comment, $.comment,
field('source', $.statement), $.statement,
), ),
comment: $ => seq(token('#'), /.*/), comment: $ => seq(token('#'), /.*/),
@ -52,8 +52,8 @@ module.exports = grammar({
$.integer, $.integer,
$.float, $.float,
$.string, $.string,
$.list,
$.boolean, $.boolean,
$.list,
$.function, $.function,
$.table, $.table,
$.map, $.map,
@ -72,7 +72,7 @@ module.exports = grammar({
list: $ => seq( list: $ => seq(
'[', '[',
repeat1(seq(field('item', $.value), optional(','))), repeat1(seq($.value, optional(','))),
']' ']'
), ),
@ -95,7 +95,7 @@ module.exports = grammar({
map: $ => seq( map: $ => seq(
'map', 'map',
'{', '{',
repeat(field('key_value_pair', seq($.identifier, "=", $.value))), repeat(seq($.identifier, "=", $.value)),
'}', '}',
), ),

View File

@ -17,12 +17,8 @@
"name": "comment" "name": "comment"
}, },
{ {
"type": "FIELD", "type": "SYMBOL",
"name": "source", "name": "statement"
"content": {
"type": "SYMBOL",
"name": "statement"
}
} }
] ]
}, },
@ -200,11 +196,11 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "list" "name": "boolean"
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "boolean" "name": "list"
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
@ -258,12 +254,8 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "FIELD", "type": "SYMBOL",
"name": "item", "name": "value"
"content": {
"type": "SYMBOL",
"name": "value"
}
}, },
{ {
"type": "CHOICE", "type": "CHOICE",
@ -430,25 +422,21 @@
{ {
"type": "REPEAT", "type": "REPEAT",
"content": { "content": {
"type": "FIELD", "type": "SEQ",
"name": "key_value_pair", "members": [
"content": { {
"type": "SEQ", "type": "SYMBOL",
"members": [ "name": "identifier"
{ },
"type": "SYMBOL", {
"name": "identifier" "type": "STRING",
}, "value": "="
{ },
"type": "STRING", {
"value": "=" "type": "SYMBOL",
}, "name": "value"
{ }
"type": "SYMBOL", ]
"name": "value"
}
]
}
} }
}, },
{ {

View File

@ -198,25 +198,18 @@
{ {
"type": "item", "type": "item",
"named": true, "named": true,
"fields": { "fields": {},
"source": {
"multiple": false,
"required": false,
"types": [
{
"type": "statement",
"named": true
}
]
}
},
"children": { "children": {
"multiple": false, "multiple": false,
"required": false, "required": true,
"types": [ "types": [
{ {
"type": "comment", "type": "comment",
"named": true "named": true
},
{
"type": "statement",
"named": true
} }
] ]
} }
@ -224,17 +217,16 @@
{ {
"type": "list", "type": "list",
"named": true, "named": true,
"fields": { "fields": {},
"item": { "children": {
"multiple": true, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "value", "type": "value",
"named": true "named": true
} }
] ]
}
} }
}, },
{ {
@ -283,25 +275,20 @@
{ {
"type": "map", "type": "map",
"named": true, "named": true,
"fields": { "fields": {},
"key_value_pair": { "children": {
"multiple": true, "multiple": true,
"required": false, "required": false,
"types": [ "types": [
{ {
"type": "=", "type": "identifier",
"named": false "named": true
}, },
{ {
"type": "identifier", "type": "value",
"named": true "named": true
}, }
{ ]
"type": "value",
"named": true
}
]
}
} }
}, },
{ {

16101
src/parser.c

File diff suppressed because it is too large Load Diff