begin/end iterate

This commit is contained in:
John Kerl 2020-09-08 23:00:10 -04:00
parent 955b924183
commit bc7833dfa7
9 changed files with 127086 additions and 126493 deletions

View file

@ -20,12 +20,19 @@ func BuildStatementNode(
var err error = nil
// xxx more to do
switch astNode.Type {
case dsl.NodeTypeAssignment:
statement, err = BuildAssignmentNode(astNode)
if err != nil {
return nil, err
}
case dsl.NodeTypeBeginBlock:
return nil, nil // xxx temp
case dsl.NodeTypeEndBlock:
return nil, nil // xxx temp
default:
return nil, errors.New(
"CST BuildStatementNode: unhandled AST node " + string(astNode.Type),

View file

@ -101,7 +101,7 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S20
Accept: 4,
Accept: 8,
Ignore: "",
},
ActionRow{ // S21
@ -133,11 +133,11 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S28
Accept: 5,
Accept: 9,
Ignore: "",
},
ActionRow{ // S29
Accept: 6,
Accept: 10,
Ignore: "",
},
ActionRow{ // S30
@ -161,7 +161,7 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S35
Accept: 16,
Accept: 5,
Ignore: "",
},
ActionRow{ // S36
@ -169,7 +169,7 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S37
Accept: 17,
Accept: 6,
Ignore: "",
},
ActionRow{ // S38
@ -193,23 +193,23 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S43
Accept: 10,
Accept: 14,
Ignore: "",
},
ActionRow{ // S44
Accept: 7,
Accept: 11,
Ignore: "",
},
ActionRow{ // S45
Accept: 7,
Accept: 11,
Ignore: "",
},
ActionRow{ // S46
Accept: 8,
Accept: 12,
Ignore: "",
},
ActionRow{ // S47
Accept: 7,
Accept: 11,
Ignore: "",
},
ActionRow{ // S48
@ -313,23 +313,23 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S73
Accept: 14,
Accept: 18,
Ignore: "",
},
ActionRow{ // S74
Accept: 11,
Accept: 15,
Ignore: "",
},
ActionRow{ // S75
Accept: 11,
Accept: 15,
Ignore: "",
},
ActionRow{ // S76
Accept: 12,
Accept: 16,
Ignore: "",
},
ActionRow{ // S77
Accept: 11,
Accept: 15,
Ignore: "",
},
ActionRow{ // S78
@ -525,7 +525,7 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S126
Accept: 18,
Accept: 7,
Ignore: "",
},
ActionRow{ // S127
@ -545,11 +545,11 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S131
Accept: 9,
Accept: 13,
Ignore: "",
},
ActionRow{ // S132
Accept: 9,
Accept: 13,
Ignore: "",
},
ActionRow{ // S133
@ -585,11 +585,11 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S141
Accept: 13,
Accept: 17,
Ignore: "",
},
ActionRow{ // S142
Accept: 13,
Accept: 17,
Ignore: "",
},
ActionRow{ // S143
@ -633,7 +633,7 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S153
Accept: 15,
Accept: 4,
Ignore: "",
},
ActionRow{ // S154

View file

@ -197,15 +197,15 @@ Lexer symbols:
81: '%'
82: '%'
83: ';'
84: '='
85: '['
86: ']'
87: '$'
88: '['
89: '@'
84: '{'
85: '}'
86: '='
87: '['
88: ']'
89: '$'
90: '['
91: '{'
92: '}'
91: '@'
92: '['
93: '|'
94: '|'
95: '='

View file

@ -310,6 +310,22 @@ StatementBlock
;
// ================================================================
// BEGIN/END BLOCKS
BeginBlock
: md_token_begin "{" "}"
<< dsl.NewASTNodeZary(nil, dsl.NodeTypeBeginBlock) >>
| md_token_begin "{" StatementBlock "}"
<< dsl.NewASTNodeUnary(nil, $2, dsl.NodeTypeBeginBlock) >>
;
EndBlock
: md_token_end "{" "}"
<< dsl.NewASTNodeZary(nil, dsl.NodeTypeEndBlock) >>
| md_token_end "{" StatementBlock "}"
<< dsl.NewASTNodeUnary(nil, $2, dsl.NodeTypeEndBlock) >>
;
// ================================================================
// ASSIGMENT STATEMENTS
@ -427,16 +443,6 @@ FullOosvar
<< dsl.NewASTNode($0, dsl.NodeTypeFullOosvar) >>
;
// ----------------------------------------------------------------
BeginBlock
: md_token_begin "{" StatementBlock "}"
<< dsl.NewASTNodeUnary(nil, $2, dsl.NodeTypeBeginBlock) >>
;
EndBlock
: md_token_end "{" StatementBlock "}"
<< dsl.NewASTNodeUnary(nil, $2, dsl.NodeTypeEndBlock) >>
;
// ----------------------------------------------------------------
// REWRITE COMPOUND ASSIGNMENT OPERATORS
//

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -11,8 +11,8 @@ import (
)
const (
numProductions = 145
numStates = 1382
numProductions = 147
numStates = 1386
numSymbols = 133
)

File diff suppressed because it is too large Load diff

View file

@ -123,6 +123,10 @@ var TokMap = TokenMap{
"$",
"empty",
";",
"md_token_begin",
"{",
"}",
"md_token_end",
"=",
"[",
"]",
@ -134,10 +138,6 @@ var TokMap = TokenMap{
"@[",
"md_token_braced_oosvar_name",
"md_token_full_oosvar",
"md_token_begin",
"{",
"}",
"md_token_end",
"||=",
"^^=",
"&&=",
@ -212,21 +212,21 @@ var TokMap = TokenMap{
"$": 1,
"empty": 2,
";": 3,
"=": 4,
"[": 5,
"]": 6,
"md_token_field_name": 7,
"$[": 8,
"md_token_braced_field_name": 9,
"md_token_full_srec": 10,
"md_token_oosvar_name": 11,
"@[": 12,
"md_token_braced_oosvar_name": 13,
"md_token_full_oosvar": 14,
"md_token_begin": 15,
"{": 16,
"}": 17,
"md_token_end": 18,
"md_token_begin": 4,
"{": 5,
"}": 6,
"md_token_end": 7,
"=": 8,
"[": 9,
"]": 10,
"md_token_field_name": 11,
"$[": 12,
"md_token_braced_field_name": 13,
"md_token_full_srec": 14,
"md_token_oosvar_name": 15,
"@[": 16,
"md_token_braced_oosvar_name": 17,
"md_token_full_oosvar": 18,
"||=": 19,
"^^=": 20,
"&&=": 21,