Require that grammars' start rules be visible
This commit is contained in:
parent
1dca3a0b58
commit
94dc703bfc
12 changed files with 64 additions and 56 deletions
13
test/fixtures/error_corpus/json_errors.txt
vendored
13
test/fixtures/error_corpus/json_errors.txt
vendored
|
|
@ -25,10 +25,11 @@ errors inside arrays
|
|||
[1, , 2]
|
||||
|
||||
---
|
||||
(array
|
||||
|
||||
(value (array
|
||||
(number)
|
||||
(ERROR)
|
||||
(number))
|
||||
(number)))
|
||||
|
||||
==========================================
|
||||
errors inside objects
|
||||
|
|
@ -38,7 +39,9 @@ errors inside objects
|
|||
|
||||
---
|
||||
|
||||
(object (pair (string) (number)) (ERROR (UNEXPECTED 'o')))
|
||||
(value (object
|
||||
(pair (string) (number))
|
||||
(ERROR (UNEXPECTED 'o'))))
|
||||
|
||||
==========================================
|
||||
errors inside nested objects
|
||||
|
|
@ -48,9 +51,9 @@ errors inside nested objects
|
|||
|
||||
---
|
||||
|
||||
(object
|
||||
(value (object
|
||||
(pair (string) (object
|
||||
(pair (string) (number))
|
||||
(ERROR (number))))
|
||||
(ERROR)
|
||||
(pair (string) (number)))
|
||||
(pair (string) (number))))
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
"name": "statement"
|
||||
}
|
||||
},
|
||||
|
||||
"statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
|
|
|||
1
test/fixtures/test_grammars/invisible_start_rule/expected_error.txt
vendored
Normal file
1
test/fixtures/test_grammars/invisible_start_rule/expected_error.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
A grammar's start rule must be visible.
|
||||
23
test/fixtures/test_grammars/invisible_start_rule/grammar.json
vendored
Normal file
23
test/fixtures/test_grammars/invisible_start_rule/grammar.json
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "invisible_start_rule",
|
||||
|
||||
"rules": {
|
||||
"_value": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{"type": "SYMBOL", "name": "a"},
|
||||
{"type": "SYMBOL", "name": "b"}
|
||||
]
|
||||
},
|
||||
|
||||
"a": {
|
||||
"type": "STRING",
|
||||
"value": "a"
|
||||
},
|
||||
|
||||
"b": {
|
||||
"type": "STRING",
|
||||
"value": "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue