Skip to content

Commit

Permalink
fix hidden NAME fields, hide VARYING keyword field
Browse files Browse the repository at this point in the history
  • Loading branch information
oppiliappan committed Jan 5, 2024
1 parent 67aa357 commit 8ba6692
Show file tree
Hide file tree
Showing 5 changed files with 493,968 additions and 747,104 deletions.
2 changes: 0 additions & 2 deletions bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ fn main() {
// If your language uses an external scanner written in C,
// then include this block of code:

/*
let scanner_path = src_dir.join("scanner.c");
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
*/

c_config.compile("parser");
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
Expand Down
6 changes: 3 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1346,14 +1346,14 @@ module.exports = grammar({
),

section_header: $ => seq(
field('name', choice($._WORD, $.integer)),
field('name', choice($.WORD, $.integer)),
$._SECTION,
optional($._LITERAL),
'.'
),

paragraph_header: $ => seq(
field('name', choice($._WORD, $.integer)),
field('name', choice($.WORD, $.integer)),
'.'
),

Expand Down Expand Up @@ -2397,7 +2397,7 @@ module.exports = grammar({
$._SEARCH,
optional(field('all', $.ALL)),
field('table_name', $.qualified_word),
field('varying', optional(seq($.VARYING, $._identifier)))
field('varying', optional(seq($._VARYING, $._identifier)))
),

set_statement: $ => seq(
Expand Down
140 changes: 127 additions & 13 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
"word": "_WORD",
"rules": {
"start": {
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "program_definition"
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "program_definition"
},
{
"type": "SYMBOL",
"name": "copybook_definition"
}
]
},
"_comment": {
"type": "PATTERN",
Expand Down Expand Up @@ -74,6 +75,25 @@
]
}
},
"copybook_definition": {
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "data_description"
},
{
"type": "REPEAT1",
"content": {
"type": "STRING",
"value": "."
}
}
]
}
},
"identification_division": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -6933,7 +6953,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_WORD"
"name": "WORD"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -6975,7 +6995,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_WORD"
"name": "WORD"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -7161,6 +7181,10 @@
{
"type": "SYMBOL",
"name": "next_sentence_statement"
},
{
"type": "SYMBOL",
"name": "execute_statement"
}
]
},
Expand Down Expand Up @@ -7247,6 +7271,14 @@
"type": "SYMBOL",
"name": "END_UNSTRING"
},
{
"type": "SYMBOL",
"name": "END_EXECUTE"
},
{
"type": "SYMBOL",
"name": "END_EXEC"
},
{
"type": "SYMBOL",
"name": "period"
Expand Down Expand Up @@ -13563,7 +13595,7 @@
"members": [
{
"type": "SYMBOL",
"name": "VARYING"
"name": "_VARYING"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -15366,6 +15398,56 @@
}
]
},
"execute_statement": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "execute_header"
},
{
"type": "SYMBOL",
"name": "execute_body"
},
{
"type": "SYMBOL",
"name": "execute_end"
}
]
},
"execute_header": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "EXEC"
},
{
"type": "SYMBOL",
"name": "EXECUTE"
}
]
},
"execute_body": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "WORD"
}
},
"execute_end": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "END_EXECUTE"
},
{
"type": "SYMBOL",
"name": "END_EXEC"
}
]
},
"_simple_value": {
"type": "CHOICE",
"members": [
Expand Down Expand Up @@ -16724,6 +16806,14 @@
"type": "PATTERN",
"value": "[eE][nN][dD]-[wW][rR][iI][tT][eE]"
},
"_END_EXECUTE": {
"type": "PATTERN",
"value": "[eE][nN][dD]-[eE][xX][eE][cC][uU][tT][eE]"
},
"_END_EXEC": {
"type": "PATTERN",
"value": "[eE][nN][dD]-[eE][xX][eE][cC]"
},
"_ENTRY": {
"type": "PATTERN",
"value": "[eE][nN][tT][rR][yY]"
Expand Down Expand Up @@ -17306,6 +17396,14 @@
"type": "PATTERN",
"value": "[nN][eE][xX][tT]"
},
"_EXECUTE": {
"type": "PATTERN",
"value": "[eE][xX][eE][cC][uU][tT][eE]"
},
"_EXEC": {
"type": "PATTERN",
"value": "[eE][xX][eE][cC]"
},
"_NEXT_SENTENCE": {
"type": "PATTERN",
"value": "[nN][eE][xX][tT]-[sS][eE][nN][tT][eE][nN][cC][eE]"
Expand Down Expand Up @@ -18495,6 +18593,14 @@
"type": "SYMBOL",
"name": "_END_WRITE"
},
"END_EXECUTE": {
"type": "SYMBOL",
"name": "_END_EXECUTE"
},
"END_EXEC": {
"type": "SYMBOL",
"name": "_END_EXEC"
},
"ENVIRONMENT": {
"type": "SYMBOL",
"name": "_ENVIRONMENT"
Expand Down Expand Up @@ -18683,6 +18789,14 @@
"type": "SYMBOL",
"name": "_NEXT"
},
"EXECUTE": {
"type": "SYMBOL",
"name": "_EXECUTE"
},
"EXEC": {
"type": "SYMBOL",
"name": "_EXEC"
},
"NO": {
"type": "SYMBOL",
"name": "_NO"
Expand Down
Loading

0 comments on commit 8ba6692

Please sign in to comment.